On Thu, Sep 25, 2008 at 2:26 AM, Robert Klemme <shortcutter / googlemail.com> wrote: > 2008/9/25 David Masover <ninja / slaphack.com>: >> Maybe it's just me, but I often use encapsulation, instead. > > Same here. In this particular case you need to ensure *all* > manipulating methods are overridden in a way that they do not break > class invariants (max size for example). Kyle's version for example > did not deal properly with #shift, #unshift, #push, #pop, #concat to > name a few. For the moment I was concentrating on the methods I would be currently using, and filling it in when I had time. Actually that would be good practice to fill it in. > Also, since inheritance is a "is a" relationship this could send the > wrong message. Can a FixedSizeArray really be used whenever an Array > is used? I doubt it. I'd like it to. This was a first blush since I needed (more wanted, but anyway) it in this project. > Method #coerce is not implemented in your classes. This has to be > done in order to make + and - work properly across the board. See > here for example Thank you, I think coerce may be just what I wanted. Lemmie give this a quick going over. > IMHO you could get rid of the shifting in your version by introducing > two position markers. Taking a really quick look at the array.c file, it looks like that's already what shift does, or did I misunderstand what I read? Being fast enough for now, I wanted to avoid premature optimization, especially if it means coding the other methods will be easier :) Thanks! --Kyle