www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: The empty statement ";" - when is it useful?

Adam D. Ruppe Wrote:

 On Wed, Jul 29, 2009 at 11:00:13AM -0400, Arthur Lloyd wrote:
 No, that looks quite good. Is the tuple() a D2 feature? D1/Tango doesn't seem
to have it? Why not even go so far as to make the tuple keyword completely

It is part of phobos 2, in std.typecons. (so you'd actually need to stick import std.typecons; at the top of the file to get that to compile.) Since it is a library solution, there is no actual keyword here, nor can it do the length thing you wanted. But, it does cover the other case quite well, without needing to change the language at all.

Does the language get too complex if this feature "gets in"? I mean you don't need to write # function((int a, b) { return a + b; }) or # complex(1.0, 2.0i) but for some reason tuple(1, 2). On the other hand you need to write 'lambda' in python when constructing inline functions. The 'lambda' is omitted in D and 'tuple' in Python. So a mixture of these languages could omit both!
Jul 29 2009