On Thu, Nov 19, 2009 at 09:25:30AM -0800, Eliot Miranda wrote:
> Hi Folks,
>
> Boris raised a fun one. See below. If y'all agree find a fix attached.
>
> On Thu, Nov 19, 2009 at 4:23 AM, Boris Popov, DeepCove Labs (YVR) <
>
[hidden email]> wrote:
>
> > Am I alone thinking these answers should be a bit more consistent?
> >
> > '' beginsWith: '' true
> >
> > '' endsWith: '' false
> >
> > 'abc' beginsWith: '' true
> >
> > 'abc' endsWith: '' false
> >
> > Specifically, any string should end with an empty substring just like any
> > string begins with an empty substring IMHO.
> >
On Squeak we currently have this:
'' beginsWith: '' ==> false
'' endsWith: '' ==> false
'abc' beginsWith: '' ==> false
'abc' endsWith: '' ==> false
And your patch would change it to this:
'' beginsWith: '' ==> false
'' endsWith: '' ==> true
'abc' beginsWith: '' ==> false
'abc' endsWith: '' ==> true
Which is clearly not the intended result.
The current Squeak behavior is quite well established, going back to at
least Squeak 2.8 (I checked on old image). Also, in Squeak we have this:
#(1 2 3 4) beginsWith: #() ==> false
#(1 2 3 4) endsWith: #() ==> false
So Squeak is internally consistent, and has not changed its behavior
in many years. Given that VW is not internally consistent, wouldn't it
be better to change VW to match Squeak?
Dave