What's the deal with __buck?
Don
nospam at nospam.com
Thu Jan 29 12:58:37 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;
You can do that with opIndex already.
More information about the Digitalmars-d
mailing list