Should pure functions be prevented from reading changeable immutable static variables?
Michel Fortin
michel.fortin at michelf.com
Sat Nov 6 06:36:10 PDT 2010
On 2010-11-05 21:32:47 -0400, Don <nospam at nospam.com> said:
> The motivation for wanting to ban them is to prevent the optimiser from
> generating bad code.
It seems to me that disabling pure optimizations inside 'static this()'
would be enough to prevent generating bad code. It's not like pure
optimizations cross function boundaries. In fact, you could still allow
the optimization of pure functions in the current module.
I understand that by restricting the semantics we could use pure to
help use break cyclic imports, but, as much as I'd like a solution to
this cyclic import problem, I don't think it's a good idea to
complicate the semantics of pure further.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list