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

IGotD- nise at nise.com
Wed Oct 20 15:43:56 UTC 2021


On Wednesday, 20 October 2021 at 11:41:32 UTC, Adam D Ruppe 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
>
>
>
> 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.

Just a small question, if you want a raw pointer to your object 
how would that look like. Since Object* is a reference (with 
things going on behind the scene), what is the raw pointer?


More information about the Digitalmars-d mailing list