Inability to dup/~ for const arrays of class objects

Jonathan M Davis jmdavisProg at gmx.com
Tue May 28 19:57:50 PDT 2013


On Tuesday, May 28, 2013 22:25:01 Steven Schveighoffer wrote:
> On Tue, 28 May 2013 22:20:08 -0400, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > On Tuesday, May 28, 2013 20:37:12 Steven Schveighoffer wrote:
> >> This is a different problem. Your problem is you can't apply const
> >> selectively to the tail of the reference. It's fundamentally sound, but
> >> D
> >> lacks the syntax to do it.
> > 
> > The syntax is actually the easy part. The problem is that the type system
> > itself doesn't differentiate between a class and a reference to a class,
> > and
> > the whole compiler is wired that way. So, while adding a new syntax
> > isn't that
> > hard (several have been proposed before), actually implementing it is a
> > royal
> > pain (enough so that Walter gave up on it). It would definitely be nice
> > to have
> > that fixed though.
> 
> No, this is wrong. The issue is entirely syntax. And it is hard, because
> *conceptually*, it's difficult to separate out the reference from the
> data. It's hard to say "The part of C that isn't the reference" in a
> succinct way.

Every time that this comes up and Walter comments on it, he makes a point of 
saying that it's _not_ a syntax issue.

- Jonathan M Davis


More information about the Digitalmars-d mailing list