--- Comment #11 from Sobirari Muhomori <dfj1es...@sneakemail.com> 2009-10-05
07:54:07 PDT ---
> Ouch. That definitely shouldn't compile. Obviously 'pure' isn't doing any
> parameter checking at all. The parameter isn't even const!!
It's const. I use 'in' instead of const.
> Note that __gshared isn't allowed in
> SafeD, but still, this is starting to look ugly.
__gshared is in fact a hack for those not ready to migrate to shared, but still
want to use normal global variables with no effect on their types.
> > Yes, two flavors of pureness can be introduces, it should be documented,
> > what
> > optimizations can be applied to them in relation to threading model. But
> > isn't
> > it a lot of work to specify and implement two flavors of pureness at the
> > same
> > time?
> No, because you can get it trivially from the function signature.
You meant, from the argument list? It doesn't really matter, whether the
parameter is const or immutable, matters only actual constness, so if caller
passes immutable argument as const to a pure function, it's the same as if
parameter was declared immutable, so the level of purity actually depends on
what arguments are passed to the function and thus changes from call to call as
caller passes arguments with different constness. So it's actually the caller
who decides pureness of the call and how to optimize it, the good news is
caller knows the constness of perameters it passes. Immutability may be
required only when callee wants to do immutable optimizations and call
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------