equivariant functions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 14 19:20:03 PDT 2008


Bill Baxter wrote:
> On Wed, Oct 15, 2008 at 11:02 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> inout(X) fun(inout(Y) function(inout(Z)) gun);
>>
>> Now you tell me which inout goes where.
> 
> Ew.  Yeh, that is sticky.  This will not be that common though.  Maybe
> you could allow arguments/indexes on the inout for those cases?
> 
>   inout[0](X) fun(inout[0](Y) function(inout[1](Z)) gun);

If you'd ask for my opinion, I'd say the show of inout stops here.

>>> and for 3:
>>>
>>> X f(return X x);
>>>
>>> where return means 'this function will return x'.  The return statements
>>> in this function are all required to return the value of x.  (x cannot be
>>> rebindable inside the function).
>> I think this is a bit too particular and too restrictive to be useful. Maybe
>> we can all be happy with whatever solution we find for the general case.
>> It's not that much to type afterall.
> 
> So what's the use case you have in mind that that doesn't satisfy?

Too many. I mean most all. Essentially you can only implement identity 
and min/max :o). Think of stripl when you need to return a slice of the 
incoming argument.



Andrei




More information about the Digitalmars-d mailing list