$ for length?

w0rp devw0rp at gmail.com
Thu Feb 20 05:17:36 PST 2014


On Thursday, 20 February 2014 at 10:28:43 UTC, Steve Teale wrote:
> How difficult would it be to allow the '$' to be used instead of
> length in something like:
>
> Thing[] ta;
> for (size_t i = 0; i < ta.$; i++)
>
> It can be used in slices, and indexes, so it might well be
> unambiguous here.

I don't like it. It's a small difference in the number of 
characters between the two on a line, and .length is much easier 
to read, especially for people new to the language. I think given 
D's smaller userbase, anything which makes a line of code easier 
to read for people coming from other languages without getting in 
the way of other things is a bonus.


More information about the Digitalmars-d mailing list