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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Paolo Bonzini-2
FWIW, gst is compatible with VW.  I'll test
#indexOfSubcollection:startingAt: later.

Paolo
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

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

John O'Keefe-2
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.

On Fri, Mar 5, 2010 at 7:46 PM, <[hidden email]> wrote:

Comment #3 on issue 555 by jfitzell: SequenceableCollection>>#beginsWith: and #endsWith: are non-portable
Ok, and you're convinced it's a Pharo/VA bug, not a VW bug? I can see an argument
either way but if #indexOfSubcollection:startingAt: says an empty collection is not
found, I don't particularly like that inconsistency.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

_______________________________________________
issues mailing list
To unsubscribe, email [hidden email]
http://lists.seaside.st/listinfo/issues



--
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

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

Paolo Bonzini-2
On 03/07/2010 03:45 PM, John O'Keefe 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:

... isn't this horribly inefficient, as it is at least O(m+n) rather
than O(min(m,n))?

  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.

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".

Paolo
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

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

Julian Fitzell-2
In reply to this post by John O'Keefe-2
On Sun, Mar 7, 2010 at 2:45 PM, John O'Keefe
<[hidden email]> 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 <[hidden email]> 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
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

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

John O'Keefe-2
In reply to this post by Paolo Bonzini-2
I meant to say 'indexOfSubcollection:', not 'indexOf:'.

On Sun, Mar 7, 2010 at 10:05 AM, Paolo Bonzini <[hidden email]> wrote:
On 03/07/2010 03:45 PM, John O'Keefe 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:

... isn't this horribly inefficient, as it is at least O(m+n) rather than O(min(m,n))?


 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.

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".

Paolo



--
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

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

Paolo Bonzini-2
In reply to this post by Julian Fitzell-2
On 03/07/2010 04:44 PM, Julian Fitzell wrote:

> 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.

Makes sense, yeah.  Guess I'll fix GST.

Paolo
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev