Matrix-type-friendly syntax and more

Don nospam at nospam.com
Tue Oct 11 00:05:51 PDT 2011


On 10.10.2011 20:03, Norbert Nemec wrote:
> On 10.10.2011 07:34, Don wrote:
>> On 10.10.2011 04:41, kenji hara wrote:
>>> 2011/10/10 bearophile<bearophileHUGS at lycos.com>:
>>>> So is this:
>>>> y[$-6, 0..$:2]
>>>>
>>>> Translated like this?
>>>> y.opIndex(y.opDollar!0 - 6, y.opSlice!1(0, y.opDollar!1, 2))
>>>
>>> I have no thought about it.
>>> I'm not sure that the additional stepping is really useful, but I
>>> think adding it into syntax is not impossible -- it might not conflict
>>> with associative array literal.
>>>
>>> Kenji Hara
>>
>> Personally, I think that since strided operations are so inefficient,
>> they should remain ugly.
>
> Inefficient?! For multidimensional arrays, all but one dimension have
> non-trivial, runtime-dependent strides anyway.

The problem is with built-in arrays.

> Anyway, the expressiveness gained by strides is significant and the
> effort to allow it in the language is minimal.

That's true, IF you are happy to have it as a feature which can only be 
used in user-defined types. If you want it apply to built-in arrays as 
well, the effort is immense.



More information about the Digitalmars-d mailing list