If you could make any changes to D, what would they look like?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Oct 20 15:06:27 UTC 2021

On Wed, Oct 20, 2021 at 11:41:32AM +0000, Adam D Ruppe via Digitalmars-d wrote:
> 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

Now *that* is a cool idea that might actually be worth doing. This would
also make it easier to refactor programs switching between class/struct:
switching from class to struct will retain reference semantics without
any trouble, and switching from struct to class will automatically catch
all the places that need attention because of potential change in


Some ideas are so stupid that only intellectuals could believe them. -- George Orwell

More information about the Digitalmars-d mailing list