What's the deal with __buck?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 29 15:00:35 PST 2009


Jarrett Billingsley wrote:
> On Thu, Jan 29, 2009 at 12:48 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> 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.
> 
> Sounds good.  Question - since length will work for multiple indices,
> will it ever be possible to have .. multiple slices?
> 
> a[x1 .. x2, y1 .. y2] = b;

That's rather exotic. After that the road is opened for free-form 
combinations of a .. b and a. But I can definitely see some good uses 
for it.

Andrei



More information about the Digitalmars-d mailing list