What would break if class was merged with struct

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Sat May 27 11:21:41 PDT 2017


On Saturday, 27 May 2017 at 17:24:14 UTC, Ola Fosheim Grøstad 
wrote:
> On Saturday, 27 May 2017 at 17:19:48 UTC, Moritz Maxeiner wrote:
>> On Saturday, 27 May 2017 at 17:02:40 UTC, Ola Fosheim Grøstad 
>> wrote:
>>
>>>
>>> The class reference type should be fixable with a rewrite 
>>> into templated smart pointers, so no need for big changes 
>>> there, I think.
>>
>> Smart pointers impose a specific object lifetime, whereas (D) 
>> classes do not. You cannot lower (D) class instances to smart 
>> pointers.
>
> In this context smart pointers are just pointers that aren't 
> raw pointers, e.g. alias this or something.

Then please don't call them "smart", because that term is 
specifically reserved for something that adds at least some 
additional features over a regular pointer (bounds checking, 
memory / lifetime management, etc.).


More information about the Digitalmars-d mailing list