Returning const? -- A potential solution
Steve Schveighoffer
schveiguy at yahoo.com
Sun Mar 8 13:39:38 PDT 2009
On Sat, 07 Mar 2009 22:44:48 -0500, Jason House wrote:
> The ugly const thread got me thinking about the old problem of returning
> an input while preserving const safety. I have an idea that seems
> reasonable...
I agree, it's very reasonable. That's why I created an enhancement
bugzilla for it last March (almost a year ago) :)
http://d.puremagic.com/issues/show_bug.cgi?id=1961
I agree the bikeshed color should not be a sticking point, but I do not
think your proposal of re-using return will work.
Specifically, return(n) in a function body has a meaning already, it
would be ambiguous to the parser probably.
I don't really love the inout(T) notation that Janice came up with, but
it has an advantage that no new keywords need to be created. I'm ok with
another new keyword or some punctuation/existing keyword combo (e.g.
const?(T))
But I'm glad we both came up with the same solution, it further gives
more validation to the idea. Please vote up my bugzilla report and add
comments if you want.
-Steve
More information about the Digitalmars-d
mailing list