DMD 0.177 release [Length in slice expressions]

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Fri Dec 22 02:14:43 PST 2006


Don Clugston wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Another way out of it is to ban "length" but stick with "$". But "$" 
>> has another bunch of problems. It's a special character used only 
>> once, and only in a very particular situation. There is no general 
>> concept standing behind its usage: it sticks out like a sore thumb. 
>> "$" isn't the last index in an array. It's that only when used inside 
>> a slice, and refers only to the innermost index of the array. Quite a 
>> waste of a special character out there, and to little usefulness.
>>
>> But if we made "$" into an operator identifying the last element of 
>> _any_ array, which could refer to the last element of _the left-hand 
>> side_ array if we so want, then all of a sudden it becomes useful in a 
>> myriad of situations:
> 
> Provided that some such expansion path for "$" exists, it would seem to 
> be adequate for D 1.0 to just remove "length". And this could be done by 
> Jan 1.

That is correct. One advantage of the unary/nullary $ is that it's a 
strict extension to today's $. Thus, no existing code will be 
invalidated by the new semantics of $.

Andrei



More information about the Digitalmars-d-announce mailing list