'const' and 'in' parameter storage classes

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 18 06:05:51 PDT 2015


On 5/15/15 2:19 PM, ref2401 wrote:
> On Friday, 15 May 2015 at 16:30:29 UTC, Steven Schveighoffer wrote:
>> On 5/15/15 12:04 PM, ref2401 wrote:
>>> What is the difference between 'const' and 'in' parameter storage
>>> classes?
>>> When should I use 'const' or 'in'?
>>>
>>> The documentation says 'in' is the same as 'const scope' but I can't
>>> write 'const scope ref' though it's legal to write 'in ref'.
>>
>> scope ref const
>>
>
> still getting the error: Error: scope cannot be ref or out

interesting. Seems you would be right then.

The only other possibility could be ref scope const, but that doesn't 
seem right, I'll try it.

Nope, so basically there is no way to do in by expanding to scope const. 
This is something that should be considered if we ever want to modify 
what 'in' means.

I am not sure yet whether "in ref" should be valid or "scope ref" should 
be valid either. It doesn't seem to me that it should trigger an error.

-Steve


More information about the Digitalmars-d-learn mailing list