On 2010-12-01 09:12:00 -0500, spir <[email protected]> said:
On Wed, 1 Dec 2010 03:17:24 -0800
Jonathan M Davis <[email protected]> wrote:
Various syntaxes have been proposed in the past. Syntax isn't really the
issue.
It's pretty easy to come up with one. I think that out of the ones I've s
een,
the I liked the best was the one proposed by Michel Fortin:
I proposed the following a while ago. First allow the class reference
to (optionally) be made explicit:
C a; // mutable reference to mutable class
C ref b; // mutable reference to mutable class
And now you can apply tail-const to it:
const(C)ref c; // mutable reference to const class
const(C ref) d; // const reference to const class
const(C) e; // const reference to const class
This is the nicest proposal, imo as well.
Is "ref" used here only because "C * b" would mean double indirection?
Yes. "C* b" already has the meaning of a pointer to a class reference,
so using '*' would be a breaking change. Beside that, if you use the
pointer syntax you'd expect to be able to use the "*b" syntax to
dereference the variable...
--
Michel Fortin
[email protected]
http://michelf.com/