Le 20/09/2012 18:39, Timon Gehr a écrit :
On 09/20/2012 04:23 PM, bearophile wrote:
Andrei Alexandrescu:
In particular, Martin has been quite impressed with our approach to
purity and immutability. We are considering a collaboration with one
of his students on a paper to formalize the approach and possibly
adapt it to Scala.
Formalizing D purity is probably possible, but it already has many
special cases, and few more are coming (see Bugzilla on this)!
Formalising it is not hard, but the D implementation will have to be
fixed. Just decouple 'immutable' and 'pure' completely,
int foo()pure{
int x;
immutable int y;
void bar()pure{
x++; // ok
}
int baz()pure immutable{
return y; // ok
}
int foo()pure immutable{
return x; // error
}
}
then rename pure to somethingother and make pure a synonym for
somethingother immutable and add that to Scala.
I proposed something similar in the epic delegate thread. I observe that
thing fall together nicely with it on several topics. It seems like the
way to go.