Question about auto ref

Timothee Cour thelastmammoth at gmail.com
Tue Mar 26 10:02:32 PDT 2013


how about '&' :

void fun(int & x);

which is same as C++ syntax, hence familiar. I thought someone had
proposed that a few weeks ago

On Tue, Mar 26, 2013 at 9:56 AM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Tuesday, March 26, 2013 17:22:29 Namespace wrote:
>> On Tuesday, 26 March 2013 at 11:41:13 UTC, Namespace wrote:
>> > I wonder, if someone has already thought about "immutable ref".
>> > I can not imagine that many use it, so it wouldn't break (much)
>> > code.
>>
>> immutable ref works (for me) very well. Are there any pitfalls
>> that I can not see?
>
> That there's no immutability involved? That would be an incredibly misleading
> choice. Not to mention, you can probably have a perfectly valid immutable ref
> right now if you want to pass a an immutable variable by ref, and using
> immutable ref for this would change its semantics. We probably just need an
> @something attribute with a good name.
>
> - Jonathan M Davis


More information about the Digitalmars-d-learn mailing list