[Seaside-dev] Re: [Seaside Issues] Issue 555 in seaside: SequenceableCollection>>#beginsWith: and #endsWith: are non-portable

Julian Fitzell jfitzell at gmail.com
Sun Mar 7 15:44:03 UTC 2010


On Sun, Mar 7, 2010 at 2:45 PM, John O'Keefe
<wembley.instantiations at gmail.com> wrote:
> No, I'm only convinced that it different on different platforms, so it is a
> portability issue.  I'm happy with resolution in either direction ( '123'
> startsWith: '' returns ture or false) since VA Smalltalk never implemented
> this method, although, since I've implemented the method in terms of
> #indexOf:, I guess I prefer the current Pharo and VA Smalltalk
> implementation since it seems more consistent., but I just think it needs to
> be consistent if Seaside is going to use it.

Ok, well I agree with that - we need to standardize one way or another
and I'm not sure of the best choice. The alternatives are not to use
it or to define a different selector (I see in my notes that we were
originally proposing that because #beginsWith: is a bit ambiguous as
to whether it should expect an item or a collection).

On Sun, Mar 7, 2010 at 3:05 PM, Paolo Bonzini <bonzini at gnu.org> wrote:
> FWIW I now checked #indexOfSubCollection: in GST and it gives an out of
> bounds error if asked for the index of an empty collection.
>
> I think #startsWith:/#endsWith: are substantially different from
> #indexOfSubCollection:, in that a limit value is clear for starting/ending
> with an empty string, but much less for "where is an empty string".

Sure, they're different, but since #indexOfSubCollection: is supposed
to return the index of the first match, it's a bit weird for
#beginsWith: to return true in any case where #indexOfSubCollection:
does not return 1, no? Similarly, if #endsWith: returns true, you'd
expect #indexOfSubCollection: to return 1 < index <
(length(collection)-length(subcollection)).

So while I'm not saying #beginsWith: '' should not return true, I am
saying that if it *should* return true, then there is a bug in the
ANSI definition of #indexOfSubCollection:. And one way or another, I'm
pretty sure the two implementations should align.

Julian


More information about the seaside-dev mailing list