If you could make any changes to D, what would they look like?
Adam D Ruppe
destructionator at gmail.com
Wed Oct 20 11:41:32 UTC 2021
On Wednesday, 20 October 2021 at 10:28:35 UTC, SealabJaster wrote:
> On Wednesday, 20 October 2021 at 10:07:40 UTC, Elronnd wrote:
>> - Class instances should not be reference types
>
> Interesting opinion. So classes would essentially be structs
> with a v-table
Well, one idea I heard last week that I don't loathe and despise
is that classes are always *explicit* references.
class Object {}
void foo(Object* o){}
That'd be the new syntax for what we have today. But:
void foo(Object o) {} // error: cannot declare variable of class
value type; the rule is still they're always references
One of the benefits of this is there's now a place for rebindable:
void foo(const(Object)* o) {} // const object, but you can rebind
the reference
That const ref thing has come up for about as long as D has had
const.
I don't really think it is worth the hassle but it is interesting
in that it solves some old syntax worries.
More information about the Digitalmars-d
mailing list