On 10/5/14, 11:23 PM, eles wrote:
On Monday, 6 October 2014 at 03:48:49 UTC, Andrei Alexandrescu wrote:
On 10/5/14, 3:08 PM, eles wrote:
On Sunday, 5 October 2014 at 14:55:38 UTC, Dicebot wrote:

The main distinction between structs and classes in D is the former
are monomorphic value types and the later are polymorphic reference
types. -- Andrei

Why hack them with scoped? The need exists, since you provide a hack for
it.

Reference classes in C++ are polymorphic & reference, but their
destructor/disposer gets called.

It doesn't because they need to be allocated dynamically. That's why there's a need for the likes of unique_ptr and shared_ptr in C++.

There is a delete that triggers that or a smart pointer. I don't care if
the delete or the destructor really frees the memory, but I would like
it to get called, to release other resources that the object might have
locked and to mark the object as "invalid". Later access to it shall
triger an exception: "invalidObject".

Call it dispose if you like, because delete is too much like freeing
memory.

Is there an intermediate type between structs and classes?

The intermediate type between struct and class is struct.


Andrei

Reply via email to