Things that make writing a clean binding system more difficult

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 29 06:11:35 PDT 2016


On 07/29/2016 03:55 PM, Jonathan M Davis via Digitalmars-d wrote:
> On Friday, July 29, 2016 14:14:49 Dicebot via Digitalmars-d wrote:
>> What you want it contradictory to the concept of "storage class".
> 
> Why? I thought the the whole idea of "storage class" was that it was an
> attribute that was applied to a type that wasn't actually part of the type.
> Certainly, based on past discussions on the topic, it seems to be that the
> term is used for pretty much anything that gets applied to a type that isn't
> actually part of the type. And that's definitely what happens with ref.
> 
> - Jonathan M Davis

Storage class has to attach to some symbol to modify its semantics
without affecting the type, it doesn't apply to type at all. Usually it
is a variable and that comes naturally but in case of function return
value / parameters the only available symbol is function itself -
contrary to variables, parameters are not available as independent
symbols AFAIK.

That said, `ref` isn't a 100% storage class, otherwise `alias Foo = ref
int function ( )` wouldn't work. Judging by only observable semantics
I'd say it is more akin to type qualifier contrary to what spec says -
but qualifier of function type.


More information about the Digitalmars-d mailing list