Should pure functions be prevented from reading changeable immutable static variables?

Michel Fortin michel.fortin at michelf.com
Sun Nov 7 03:33:48 PST 2010


On 2010-11-07 01:41:47 -0500, Don <nospam at nospam.com> said:

> The guarantee of independence is the most important feature. From a 
> performance point of view, the big win 'pure' gives you comes from 
> memory management. All memory allocation can be done using a 
> thread-local memory pool.

Hum, are you sure about that? If a pure function allocates and returns 
a string, nothing prevents the non-pure calling function from sending 
that string to another thread. If that string is allocated from a 
thread-local pool, what happens?

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list