Multiple return values...

Manu turkeyman at gmail.com
Tue Mar 13 02:12:21 PDT 2012


On 13 March 2012 06:45, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org>wrote:

> 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.


Okay sorry, let me clarify. My own personal stance is unchanged, but I
appreciate your assertion of priorities and I relent :)
This topic has meandered between 2 distinct threads, syntax and abi, and I
feel strongly about both, so maybe my personal sense of priority comes
across wrong as I'm discussing one topic or the other.

Trying to see it from a practicality standpoint, there is a pull request
there which would seem like a near-complete implementation of the
syntax, so that's a much easier/smaller step than messing with the ABI.
Also, the syntax element of the feature will benefit far more people, and
more immediately.
Note, I still find myself wanting this feature, at least syntactically,
every other day (my motivation starting the thread initially). But for my
purposes (simd math library currently) it wouldn't do for it to be
inefficient. At least the promise of an efficient implementation down the
road is needed to make use of it.

I think I feel a sense of urgency towards the ABI aspect because it is a
breaking change, and I suspect the longer anything like that is left, the
less likely/more risky it becomes.
If it gets delayed for 6-12 months, are you honestly more or less likely to
say it's a good idea to fiddle with the ABI?

I am sold on the Tuple approach now, so that's a big discussion that can be
dismissed. I think it was as a result of realising this that the ABI became
of higher importance in my mind, since I agree, workable syntax is
technically possible already (although ugly/verbose).


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.
>

Shall we discuss the shortcomings of his implementation? Can someone
demonstrate the details of his implementation?
>From the little examples up in the thread, it looked like you could only
declare new variables inline, but not assign out to existing ones. I'd say
this needs to be added too, and perhaps that will throw the whole design
into turmoil? ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120313/e1a74fc6/attachment.html>


More information about the Digitalmars-d mailing list