Why D needs tail const

Stewart Gordon smjg_1998 at yahoo.com
Wed Mar 28 08:09:12 PDT 2012


I'm not sure how my post ended up in .announce, but anyway....

On 28/03/2012 15:24, bearophile wrote:
<snip>
> Is it possible to invent a language construct that allows:
> const(Rebindable!(const(....)))
> To be defined as the same as:
> Rebindable!(const(....))

You mean be defined the same as
const(...)
?  It's the only thing that makes sense.

> Something like an onConst()/onImmutable templated methods for structs/classes?

Maybe something like

struct Rebindable(T) {
     alias const(T) onConst;
}

which would make const(Rebindable!(T)) just const(T)?

I'm not sure whether this would be a good idea.  And it would solve only one of 
Rebindable's many shortcomings....

Stewart.


More information about the Digitalmars-d-announce mailing list