The empty statement ";" - when is it useful?

Arthur Lloyd via at google.com
Wed Jul 29 08:15:59 PDT 2009


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 optional?
> 
> 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!



More information about the Digitalmars-d mailing list