pure or not pure?

Janice Caron caron800 at googlemail.com
Thu Apr 10 06:24:10 PDT 2008


On 10/04/2008, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>  I want it to act like new does.  For example, if I have
>
>  char[] c = new char[5];
>
>  in two different pure functions, new better not return the same exact memory
>  space for both!

You're overcomplicating this. The rule is

    same input => same output

And I would put good money on the notion that "same" means "compares
as equal with the == operator".

(And that almost certainly means that mutable char[]s won't be allowed
as parameters to pure functions - because strings and char[]s with the
same content compare as equal)



More information about the Digitalmars-d mailing list