On Saturday, 27 May 2017 at 17:28:47 UTC, Stanislav Blinov 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.
Lower? No. Wrap - yes. With "scope" from DIP1000 you can even
do it in a safe manner.
Maybe I was not clear: Of course you can put a class reference
inside a struct, or even simulate a class using a rewriting
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.