Const Ideas
Bill Baxter
dnewsgroup at billbaxter.com
Sat Dec 1 11:27:30 PST 2007
Janice Caron wrote:
> On 11/30/07, Jason House <jason.james.house at gmail.com> wrote:
>> Craig Black wrote:
>> Technically, I proposed the syntax. Janice didn't like it at first but has
>> now come full circle.
>
> That's right. I think my earlier attempt was something like
> "const(X)ref" or "ref const(X)". I came full circle and now fully
> support Craig's idea, largely because I think there may come a time in
> the future when D has C++-style references. If and when that day
> comes, "&" will be preferable to "ref" for the same reason that "*" is
> preferable to "ptr".
Pointers can be stacked like T***. References cannot. The 'ref' can
only ever apply to the head. So I think a syntax with ref in front
would be workable if Walter wants to go that way. In some ways it makes
more sense to put the sigil for references out in front because, for the
most part, ref doesn't affect the way you use the thing. ref T acts
just like a T for most purposes, whereas T* is a quite different thing.
--bb
More information about the Digitalmars-d
mailing list