On Fri 30 Aug 2019 at 09:34, Julien <julien.delplan...@inria.fr> wrote:

> Hello,
>
> I opened that issue: https://github.com/pharo-project/pharo/issues/4442
>
> And I think to fix it we need to actually discuss about what we want.
>
> #allButFirst: behaves differently depending on the actual type of
> sequenceable collection when argument is greater than collection size.
>
> For instance:
>
> #(1 2) allButFirst: 3.  "PrimitiveFailed signaled"
> (LinkedList with: 1 with: 2) allButFirst: 3. "PrimitiveFailed signaled"
> (OrderedCollection with: 1 with: 2) allButFirst: 3.  "an
> OrderedCollection() »
>
> The question is then, who is right?
>
> Should #allButFirst: with an argument greater than the collection size
> raise an error
>
> Or
>
> Should #allButFirst: with an argument greater than the collection size
> returns an empty collection ?
>
> I asked a few people about it @ ESUG and it appears that the expected
> behaviour from #allButFirst: is not the same to all people.
>
> We need to decide so we improve consistence of collections.
>
> And then, we need to document that with a test :-).
>

Hi,

I was one of the person who discussed this with Julien at ESUG and IMO it
should launch an error.

While working on complexe models, errors in such cases are really really
really helpful to find bugs. Errors such as SubscriptOutOfBound or NotFound
help me a lot to find bugs and sometimes without this kind of methods it
could have take me days to find the problem (and it’s only in the case I
know there is a bug).


> Cheers.
>
> Julien
>
> ---
> Julien Delplanque
> Doctorant à l’Université de Lille
> http://juliendelplanque.be/phd.html
> Equipe Rmod, Inria
> Bâtiment B 40, Avenue Halley 59650
> <https://www.google.com/maps/search/40,+Avenue+Halley+59650+Villeneuve+d'Ascq?entry=gmail&source=g>
>  Villeneuve
> <https://www.google.com/maps/search/40,+Avenue+Halley+59650+Villeneuve+d'Ascq?entry=gmail&source=g>
>  d'Ascq
> <https://www.google.com/maps/search/40,+Avenue+Halley+59650+Villeneuve+d'Ascq?entry=gmail&source=g>
> Numéro de téléphone: +333 59 35 86 40
>
> --
Cyril Ferlicot
https://ferlicot.fr

Reply via email to