Local functions infer attributes?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 19:43:17 PDT 2014


On 9/28/2014 6:31 PM, Manu via Digitalmars-d wrote:
>>    S!(int, S*)
> That's different.
>
> I feel like I have to somehow justify to you guys how meta code works
> in D. I have meta code that is no less than 5 layers deep. It's
> complex, but at the same time, somehow surprisingly elegant and simple
> (this is the nature of D I guess).
> If I now assume throughout my meta "pointer means ref", then when I
> actually pass a pointer in, the meta can't know if it was meant to be
> a ref or not. It results in complex explicit logic to handle at almost
> every point due to a loss of information.
>
> You can't call f() with the same syntax anymore (you need an '&')
> which is a static if in the meta, you can't use the S* arg in the same
> meta (needs a '*') which is another static if. Assignments are
> changed, and unexpected indexing mechanics appear. When implementation
> logic expects and understands the distinction between pointers and
> ref's, this confuses that logic. When I interface between languages
> (everything I never do binds to at least C++, and in this case, also
> Lua), this complicates the situation.
>
> I can't conflate 2 things that aren't the same. It leads to a lot of
> mess in a lot of places.

You're right that tuples in D cannot contain storage classes (and ref is just 
one storage class, there's also out and in, etc.).

You can use autoref, but I haven't understood why that doesn't work for you.



More information about the Digitalmars-d mailing list