Multiple return values...

Iain Buclaw ibuclaw at ubuntu.com
Tue Mar 13 04:27:05 PDT 2012


On 13 March 2012 09:12, Manu <turkeyman at gmail.com> wrote:
> 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).
>
>

What about alternative optimisations for MRV, rather than stating that
it should always be returned in registers where possible (and breaking
ABI on all target platforms).  What about, for example, using named
return value optimisation in this case to help improve the cost of
returning on non-x86 architectures.

Just throwing random thoughts out there.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list