What's the deal with __buck?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 29 09:48:37 PST 2009


BCS wrote:
> Hello Bill,
>>
>> I guess what's required is the ability to define the __dollar in the
>> scope of a class/struct/template.
> 
> I think that is the correct solution.

Ok, thanks to all. So __dollar is looked up at module scope for anything
that's not a built-in array.

I thought some more about it and I think there's no need for __dollar.
It's enough that:

a) In slice expressions and index expressions with one argument, $ 
expands to value.length, where value is the object being indexed/sliced 
(if an unnamed temporary, the value is of course only evaluated once)

b) In index expressions with multiple arguments, $ expand to 
value.length(i), where i is the zero-based argument position.

This is exactly enough what's needed to make it all work. Infinite
ranges may define a symbolic infinite length and overload slicing on it.


Andrei



Andrei



More information about the Digitalmars-d mailing list