On 15 July 2010 07:23, Charles Oliver Nutter <[email protected]> wrote: > I like language-level immutability. I do not like forced "everything > is immutable", and current VMs/GCs don't appear to either. I think > there's a happy medium between the two that no current language has > really found. I've been considering ways to do it in Mirah...
Have you looked at Fantom's solutions here? Perhaps it has the happy medium you're thinking of. Immutable is hard-coded into the type system. A class is declared as immutable using a keyword (const). Lists, maps and functions can be converted to immutable (and will do so automatically by the compiler). http://fantom.org/doc/docLang/Classes.html#const http://fantom.org/doc/docLang/Fields.html#const The approach extends to concurrency. Actors will pass objects by value if they are immutable http://fantom.org/doc/docLang/Concurrency.html#immutability Another elements is the key in a hashmap, which must be immutable. Plus, there are special solutions for handling all this in the constructor. Even if its to only steal ideas, its worth taking a look. Stephen -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
