Proposal: Relax rules for 'pure'

klickverbot see at klickverbot.at
Wed Sep 22 04:49:02 PDT 2010


On 9/22/10 4:21 AM, Don wrote:
> PROPOSAL:
> Drop the first requirement. Only one requirement is necessary:
>
> A pure function does not read or write any global mutable state.
>
> If a pure function has parameters that are all immutable or are
> implicitly convertible to immutable, then the compiler is permitted to
> cache the results.

I also support this proposal. In its current state, pure is pretty much 
useless, since you almost can't do anything serious with pure functions, 
let alone generic programming – it seems more like an excuse for not 
adding logic to determine whether a result can be cached to the 
optimizer than a true language feature…


More information about the Digitalmars-d mailing list