What would break if class was merged with struct

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sat May 27 11:42:02 PDT 2017


On Saturday, 27 May 2017 at 18:26:07 UTC, Moritz Maxeiner wrote:
> mechanism, but you *cannot*  use a smart pointer as a 
> replacement for a class instance, because the latter is normal 
> pointer, and the former adds features on top of a pointer; they 
> cannot be the same as a matter of definition, i.e. you cannot 
> replace classes with smart pointer structs on the language 
> level, because it removes features from the language.

I am not sure what you mean here. As long as the "smart pointer" 
is in a subtype relationship with the current "class reference" 
then it can add features, yes?

You could do this as a compiler configuration even, switch out GC 
with ref-counting smart pointers.

The point of this thread was to have fewer language constructs, 
with more lowering, so that the resulting language would be a 
super-language, that fully covers the original language (or close 
to it).



More information about the Digitalmars-d mailing list