Most basic nothrow, pure, @safe functions?

Walter Bright newshound2 at digitalmars.com
Fri Mar 21 00:14:51 PDT 2014


On 3/21/2014 12:03 AM, monarch_dodra wrote:
> On Friday, 21 March 2014 at 03:04:36 UTC, Steven Schveighoffer wrote:
>> Thinking about it some more, I see what you mean -- an unshared mutex is useless.
>>
>> But at the same time, some "logically" pure functions cannot be so without
>> mutexes. E.g. memory allocation.
>
> Since when does "shared" => "impure" ?
>
> If the function takes a pointer to shared data, then you are explicitly saying
> "this function depends on this shared data". But as long is it isn't referencing
> some *other* global directly, it is perfectly pure.

We've been using 'shared' here to mean shared with another piece of code that 
looks at the state, not 'shared' as in data shared amongst multiple threads.



More information about the Digitalmars-d mailing list