Reddit: why aren't people using D?

Leandro Lucarella llucax at gmail.com
Thu Jul 23 13:50:25 PDT 2009


Walter Bright, el 23 de julio a las 12:11 me escribiste:
> >>>* Tuples (no dedicated syntax, no parallel assignment, no non-flattening
> >>>tuples without workarounds, no returning tuples)
> >>The flattening thing is a problem. The rest can be done with better
> >>library support.
> >You cannot get a dedicated syntax with library support.
> 
> Of course that's true, but why is a dedicated syntax better than Tuple!( ...) ?

When I see this, I think about this:

for (std::vector<int>::const_iterator i = v.begin(); i != v.end(); ++i) {
	int x = *i;
	...
}

Why is foreach (x; v) ... better than the former?

The problem is, if is hard to write, or ugly to read, people won't use it,
or will use it less. In Python tuples are easy to read and write, so
people use them everywhere and they are really useful (especially for
FP-style programming, where is more common to return multple values).

I think that library tuple *implementation* is a great idea (like library
dynamic and associative arrays implementations), but not having support in
the language for tuples is bad (like it will be not to have dynamic and
associative arrays). I think the 3 are very fundamental types and deserves
language support.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
<original> [Penis Uptime: 2days 13hrs 59mins 35secs]
<Yapa> viagra? :)
<original> yea, 20 pills



More information about the Digitalmars-d mailing list