Declaring Ref Variables Inside Function Calls

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Mar 31 18:42:46 PDT 2009


Leandro Lucarella wrote:
> Andrei Alexandrescu, el 31 de marzo a las 17:55 me escribiste:
>>> But in Python or ML, no question. I'd happily write a function that
>>> returns (2, 4.2) without giving it much thought.  Now perhaps cogent
>>> arguments like "blech" and "belch" can convince me that I should
>>> embrace the Tuple!(int,float) and use it everywhere, just like I'd use
>>> tuples in Python and ML, but so far I'm not convinced.
>>> To me it seems to be in the same league as int[] vs std::vector<int>.
>>> int[] -- great I'll happily use that everywhere.  std::vector<int>
>>> kind of a pain, use begrudgingly as needed.
>> Well I think a language can only have so many built-in types. We can't
>> go on forever.
> 
> You don't have to. There are very few types that are extremely useful to
> build up things having a good syntax. I think Python got this right:
> tuples, lists, hashes. That's all you need as first class citizens
> (speaking of "containers"). I think D is only missing tuples (dynamic
> arrays works just fine as lists in D).
> 

So we must add lists too.

Andrei



More information about the Digitalmars-d mailing list