On Fri, Jun 4, 2010 at 4:06 AM, Jon Harper <[email protected]> wrote:
> On Fri, Jun 4, 2010 at 4:32 AM, Slava Pestov <[email protected]> wrote:
>> Hi Kobi,
>>
>> Do not override the nth and set-nth generic words for this purpose.
>> These words should only be used for collections with integer indices
>> 0..length-1.
> Even if bounds-check is also overriden to correctly handle the array
> of indices ?
> Why can't multiarrays be part of the sequence protocol when they reuse
> 90% of the code ? Doesn't this mean that the sequence protocol should
> be broadened ?

There's more to the sequence protocol than bounds checking. Right now,
you're guaranteed to be able to take the length of any sequence and
address its contents from 0 to (length - 1), and pretty much every
sequence combinator is built on this assumption. If you want to reuse
an existing protocol for n-dimensional arrays, the more general assocs
protocol would make more sense, using index arrays as keys.

-Joe

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to