On 03/26/14 15:36, Kagamin wrote:
> On Tuesday, 25 March 2014 at 23:30:28 UTC, Artur Skawina wrote:
>> It's ok to treat allocator and factory functions as pure, because those 
>> really
>> are logically pure, ie can't affect any /visible/ state and return results 
>> that
>> are unique.
> 
> Allocators don't return unique results, GC being the primary example.

I'm not really sure what your point is. I was saying that "allocator functions",
ie functions that return newly allocated objects, can be treated as pure as long
they do not have any other visible side effects and the result is "unique", ie 
does
not have any aliases. This will be true in many cases. The /implementation/ 
won't
likely be pure, but from the caller's POV this is irrelevant. A way to make 
those
functions appear pure would allow for more pure /callers/; that's why Steven was
asking for a way to "force" purity.
Even C compilers are treating 'malloc' etc specially, exactly because they can
assume that nothing aliases the returned object.

artur

Reply via email to