Is This a Bug
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 25 10:31:01 PDT 2011
On Tuesday, October 25, 2011 03:13 Gor Gyolchanyan wrote:
> Pure functions don't need synchronization. Pure functions should not
> be a subject to shared-ness.
Why? All it means when a function is pure is that it can't access any static
or module-level variables which can ever be mutated over the course of the
program. It has nothing to do with shared or synchronization. True, there are
circumstances under which calls to a pure function can be optimized out (e.g.
when all of its parameters are immutable or implicitly convertible to
immutable), but there's nothing stopping you from creating pure functions
which take or return shared variables, and those functions could be called
just like any other function which takes or returns shared variables.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list