Multiple return values...

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Mar 12 21:45:12 PDT 2012


On 3/12/12 3:37 AM, Manu wrote:
> On 12 March 2012 04:44, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org <mailto:SeeWebsiteForEmail at erdani.org>>
> wrote:
>
>     On 3/11/12 6:30 PM, Manu wrote:
>
>         D should
>         define an MRV ABI which is precisely the ABI for passing
>         multiple args
>
>         TO a function, but in reverse, for any given architecture. This
>         also has
>         the lovely side effect of guaranteeing correct argument
>         placement for
>         chain-called functions.
>
>
>     I'm quoting this because it is the tersest and clearest expression
>     of the actual request.
>
>     It's a nice feature to have, but so are many others. I don't know
>     what it would cost to implement (my guess is: high), and how large
>     the benefits would be in various projects.
>
>
> Is this basically like saying it'll never happen?

Not at all. All I'm saying is we need to have a sense of priority. Right 
now everything that comes up has absolute priority, but somehow 
shouldn't make the previous hot topics enjoy the same level. Getting 
excited is easy. Lucidly analyzing and prioritizing is difficult.

> There is already a pending pull request implementing the syntax, that
> addresses half of the feature straight up.. codegen can come later, I
> agreed earlier that it is of lesser importance.

You see, at this point I have no idea what to believe anymore. You 
argued very strongly from the position of one whose life depends on 
efficiency. Here and there you'd mix some remark about syntax, and I'd 
like "whaa?..." but generally discounted it as distraction from the main 
point, which was that all you must do is f(g()) where the body of g() is 
insignificantly small, which makes the cost of passing arguments around 
absolutely paramount.

And now you come with this completely opposite viewpoint in which the 
syntax is paramount and urgent, whereas codegen is like let's leave it 
for later. I really am confused.

> You don't see the immediate value in a convenient MRV syntax? It would
> improve code clarity in many places, and allow the code to also be more
> efficient down the road.

I see value in Kenji's related diff, but not in adding syntax to e.g. 
return "(int, int)". But we want to make sure we address the matter 
holistically (for example: is Kenji's diff enough, or do we need to 
worry about assignment too?). The worst strategy in chess is to move a 
piece and then start analyzing the new situation on the board.

> D seems rather feature-complete. What many other major features are on
> the cards if I may ask?

You mean designing new features? Not a lot, but this is a moot point 
anyway because the work for scatter initialization has already been done.


Andrei


More information about the Digitalmars-d mailing list