Do pure functions solve the "return const" problems?
Yigal Chripun
yigal100 at gmail.com
Wed Apr 2 12:02:42 PDT 2008
Steven Schveighoffer wrote:
> Like I said, never used pure functions before. So what you are saying is
> that the purpose of pure functions is to allow parallelization within the
> context of a SINGLE thread? So multiprogramming has nothing to do with
> multi-threading?
>
> I always thought Walter's grand vision was to use pure functions to make
> multi-threaded programming easier...
>
> -Steve
>
>
>
after reading this whole thread I think I get your point and I agree
with it. However, I have a few remaining questions:
1) since the purpose of pure functions as I understand it is thread-safe
functions, than why should we care if they have side affects as long as
they are thread-safe? what I basically want to know is whether the
following scenario should be allowed:
a "pure" function contains a thread-safe side affect like changing some
global variable inside a synchronized() block.
2) why do we need read only view (aka const) at all if const is logical?
isn't const equivalent with partial purity (the code the access a const
variable is pure)?
confused, Yigal
More information about the Digitalmars-d
mailing list