On Wed, 17 Nov 2010 02:03:05 -0500, Rainer Deyke <rain...@eldwood.com>
wrote:
On 11/16/2010 21:53, Steven Schveighoffer wrote:
It makes me think that this is going to be extremely confusing for a
while, because people are so used to pure being equated with a
functional language, so when they see a function is pure but takes
mutable data, they will be scratching their heads. It would be awesome
to make weakly pure the default, and it would also make it so we have to
change much less code.
Making functions weakly pure by default means that temporarily adding a
tiny debug printf to any function will require a shitload of cascading
'impure' annotations. I would consider that completely unacceptable.
As would I. But I think in the case of debugging, we can have "trusted
pure." This can be achieved by using extern(C) pure runtime functions.
(Unless, of course, purity is detected automatically without the use of
annotations at all.)
That would be ideal, but the issue is that the compiler may only have the
signature and not the implementation. D would need to change its
compilation model for this to work (and escape analysis, and link-time
optimizations, etc.)
-Steve