[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bindings and assignments (was: Re: continuations)



Shriram Krishnamurthi wrote:
 > This problem is made worse in languages like Java that don't offer
 > distinct syntactic forms for these two operations.

Java does offer distinct syntactic forms for these, sort of.

    private static void frobnivate(final Foo foo, final Bar bar) {
        final Quux quux = Quux.newInstance(foo, bar);
        doStuff(quux);
        doSomeMoreStuff(quux);
    }

Since quux is final, it can't be reassigned.  (If it's an instance of
a mutable class, it can be mutated of course, but I don't think that's
the kind of mutation that you were referring to.)

Similarly, foo and bar are bindings - not assignments.

If you don't use the "final" keyword, then the variable can be
reassigned (in the set! sense).

Does that qualify as a syntactic distinction?

 > In effect, you have to reconstruct the programmer's intent by
 > analyzing the source (looking, for instance, for static
 > single-assignment).