Does D have too many features?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Apr 30 17:25:21 PDT 2012


On Tue, May 01, 2012 at 02:14:42AM +0200, bearophile wrote:
> Timon Gehr:
> 
> >* I agree on supporting deducing length for static arrays. (there
> >is a
> >  int[$] arr = [1,2,3]; proposal.)
> 
> Someone in Bugzilla ha just proposed an alternative idea, that
> despite not looking very nice, is not overall bad (here with a small
> change):
> 
> auto arr = [1, 2, 3]f;
> 
> That trailing f denotes a fixed-side array/string literal. So it's
> usable for other situations too.
[...]

I don't like it. An f prefix already means float in another context;
overloading it to also mean static array is a bad idea. D already has
too much overloaded syntax (like static meaning all sorts of diverse
things depending on context). I much prefer the int[$] proposal, because
$ already means "length of array" in D, and so would fit right in.


T

-- 
We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare.  Now, thanks
to the Internet, we know this is not true. -- Robert Wilensk


More information about the Digitalmars-d mailing list