> 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.
Hi Stephen The problem with using a marker/keyword for immutability is that as soon as you touch a class outside of your own type system, which itself is not so marked, you have no (easy) way to tell if it is also immutable; that's a general problem, as far as I know. How does Phantom handle interaction with the huge number of non-immutable classes out there in the wild in all those useful JVM libraries? Thanks Patrick -- 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.
