Declaring Ref Variables Inside Function Calls

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Mar 31 17:57:06 PDT 2009


Daniel Keep wrote:
> 
> Andrei Alexandrescu wrote:
>> Jarrett Billingsley wrote:
>>> On Tue, Mar 31, 2009 at 3:18 PM, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> import std.typecons;
>>>>
>>>> Tuple!(int, float) foo()
>>>> {
>>>>    return tuple(2, 4.5);
>>>> }
>>>>
>>>> The addition of the alias this feature and of constructor templates
>>>> makes
>>>> std.typecons.Tuple even better.
>>>>
>>> Cool, but..
>>>
>>> Why not just make tuples first-class types?  <_<
>> Why not not?
>>
>> Andrei
> 
> Because people keep having to invent hacks to work around the fact that
> we can't return tuples.  std.typecons.Tuple is a perfect example of this.

"It's not a hack, it's a feature."

If you don't have a list in the language and build it as a user-defined 
type, is that a hack?

Andrei



More information about the Digitalmars-d mailing list