Uh... destructors?

Kevin Bealer kevindangerbealer at removedanger.gmail.com
Wed Feb 23 20:20:23 PST 2011


== Quote from bearophile (bearophileHUGS at lycos.com)'s article
...
> Currently you are able to write functions like:
> pure bool randomPure() {
>     int[] a1 = new int[1];
>     int[] a2 = new int[2];
>     return a1.ptr > a2.ptr;
> }

Is it possible to fix this by disallowing using the value of a pointer,
except allowing them to be compared for equality (only)?  In other words,
within a pure function, only 'is' '!is', ==, != are permitted as tests
of pointers?  Other arithmetic forbidden... this sort of matches the Java
model where you can't fiddle with references except to check if they are
the same.

Kevin


More information about the Digitalmars-d mailing list