Can we just have struct inheritence already?

Exil Exil at gmall.com
Thu Jun 13 20:20:19 UTC 2019


On Thursday, 13 June 2019 at 19:51:12 UTC, Timon Gehr wrote:
> On 13.06.19 21:44, Walter Bright wrote:
>> On 6/13/2019 4:30 AM, Timon Gehr wrote:
>>> Yes. IMHO this shouldn't be a @safe pure operation.
>> 
>> D regards converting a pointer to an int as safe, but not the 
>> other way around.
>
> I know, and that is fine, but casting a pointer to int is not 
> pure. It glances into the global state maintained by the memory 
> allocator.

The operation is pure. Accessing global state is the part that is 
not pure. For convience I guess you can allocate memory, 
otherwise it wouldn't be that useful. Pure for the most part 
guarantees you don't access global variables. Pure doesn't mean 
deterministic.


More information about the Digitalmars-d mailing list