Just where has this language gone wrong?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 23 19:21:18 PDT 2012


On 7/23/12 5:14 PM, Simen Kjaeraas wrote:
> On Mon, 23 Jul 2012 22:51:19 +0200, Stuart <stugol at gmx.com> wrote:
>
>> Saves us having to create a struct for every goddamn little function;
>> or using tuples directly, which means we have to refer to variables
>> like .value1 and .value2 instead of something meaningful.
>
> You mean like this?
>
> Tuple!(float, "x", float, "y") bar() {
> return typeof(return)( 0.0, 0.0 );
> }
>
> auto xCoord = bar().x;
>
>
> I dislike the typeof(return) in there, as assignment between tuples with
> and without named fields works perfectly. Bring me the sky, Walter?

We could make

return tuple(0.0, 0.0);

to work. I can't imagine a scenario in which this relaxation would cause 
a bug.


Andrei



More information about the Digitalmars-d mailing list