RFC, ensureHeaped

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 16 23:28:37 PST 2010


On Tuesday 16 November 2010 23:03:05 Rainer Deyke 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.
> 
> (Unless, of course, purity is detected automatically without the use of
> annotations at all.)

It has already been argued that I/O should be exempt (at least for debugging 
purposes), and I think that that would could be acceptable for weakly pure 
functions. But it's certainly true that as it stands, dealing with I/O and 
purity doesn't work very well. And since you have to try and mark as much as 
possible pure (to make it weakly pure at least) if you want much hope of being 
able to have much of anything be strongly pure, it doesn't take long before you 
can't actually have I/O much of anywhere - even for debugging. It's definitely a 
problem.

- Jonathan M Davis


More information about the Digitalmars-d mailing list