$ for length?

Chris wendlec at tcd.ie
Thu Feb 20 05:52:19 PST 2014


On Thursday, 20 February 2014 at 13:17:37 UTC, w0rp wrote:
> 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.

Why not have both?


More information about the Digitalmars-d mailing list