[Pharo-project] Stack should be reimplemented with Array

Levente Uzonyi leves at elte.hu
Mon Oct 18 17:25:25 EDT 2010


On Mon, 18 Oct 2010, Igor Stasenko wrote:

> Stephane, i could say more:
> - i don't like how LinkedList implemented.
>
> I don't see why it should mimic things like #at: #at:put: at all..

It's not mimicing those methods. A list usually support things like this, 
but the user should know the consequences.

> IMO this protocol should be pruned from it, to not provoke uses which
> completely do not fit for given data structure.

I'm not sure if it's okay to remove features, because users lacking really 
basic CS knowledge may use them the wrong way.

>
> Removing/inserting into the middle of list is quite ineffective
> operation (O(n)),

As long as you don't give away the link objects, it's O(n), otherwise it 
can be O(1).

> while inserting at the begginning/end of list is O(1).
>
> Lists are sequenceable.. but sequenceable ~~ indexable. Period.

Sequenceable is indexable, but good performance is not guaranteed.


Levente

>
> -- 
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>




More information about the Pharo-dev mailing list