Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

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

Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium GLASS-Server Version-GLASS0.231

New issue 206 by pdebruic: default String sorting differs between Gemstone  
& Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

What steps will reproduce the problem?
1. In a workspace in Pharo and Gemstone print:
#( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' ) asSortedCollection



What is the expected output? What do you see instead?
I'd hope that by default they sort to the same order.  You can get Gemstone  
to sort into Pharo's default order (lower ascii values first) if you use a

SortedCollection new sortBlock: [:a :c | a asciiLessThan c]

And you can get pharo to sort into Gemstone's default order by

SortedCollection new sortBlock: [:a :c | a caseInsensitiveLessOrEqual: c].


I'd like the differences to be handled by Grease or something.



What version of the product are you using? On what operating system?
Gemstone 2.4.4.1 and Gemtools 1.0b4 on Ubuntu 64 bit amd64.

Please provide any additional information below.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb
Updates:
        Labels: -Version-GLASS0.231 Version-1.0-beta.8 Milestone-1.0-beta.8.5

Comment #1 on issue 206 by [hidden email]: default String sorting  
differs between Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

I'll see what I can do for this...

Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb

Comment #2 on issue 206 by pdebruic: default String sorting differs between  
Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

Or maybe there should just be a porting guide on the wiki with  
idiosyncracies like this where there isn't a right way to do it but there  
is a difference in the defaults between the two implementations.

Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb
Updates:
        Status: Accepted

Comment #3 on issue 206 by [hidden email]: default String sorting  
differs between Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

caseInsensitiveLessOrEqual: is implemented in CharacterCollection so that  
method can be used in both GemStone and Pharo to give the same sort order.

#( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' )
    asSortedCollection: [:a :c | a caseInsensitiveLessOrEqual: c].

Would this work for you?

Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb

Comment #4 on issue 206 by pdebruic: default String sorting differs between  
Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

The collection of strings I'm trying to sort has to be sorted in ascending  
ascii order, so not really.  Sorry for not being more specific.

Among other things, I think I just need to make myself some custom  
functions in my package and override them with others when I load it into  
gemstone.   I keep finding other things that don't seem to have an easy  
solution when porting.  Another example is that in Pharo

#Symbol = 'Symbol'

prints true but in gemstone it is false.  I have some XML parsing code from  
pharo that specifies the element names as symbols.  So I can just override  
elementAt: and tagsNamed:do: in gemstone to test for a symbol and convert  
it to a string.

Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb

Comment #5 on issue 206 by [hidden email]: default String sorting  
differs between Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

Paul,

As for the collection of strings you're trying to sort, I don't understand  
why that didn't work. I guess it still isn't clear to me which message is  
missing on which platform so an example with your desired result is what I  
need ...

As for #Symbol = 'Symbol', Pharo is not following the ANSI standard, so you  
need to make sure that you never intermix strings and symbols expecting  
symbols and strings to compare equal ... this is one of the nastiest bugs  
to track down .... I've also noticed that folks write a lot of _tests_ that  
rely on Strings and Symbols comparing equal...

Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb

Comment #6 on issue 206 by pdebruic: default String sorting differs between  
Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

Hi Dale,

Thanks for the pointer about the Symbols. I didn't know and have removed  
them.  I'm sorry I didn't do a good job of explaining what I'm looking for.

I want the array:
      #( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' )

when sorted to look like:
      #('MM' 'Mm' 'c' 'mM' 'mb' 'mm' 'x')


the command:
      #( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' ) asSortedCollection: [:a :c | a  
asciiLessThan: c]

does it in Gemstone and the command:
      #( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' ) asSortedCollection

does it in Pharo.  I can just add an extension #asciiLessThan: to Pharo and  
be all set.





Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

Dale Henrichs
On 12/09/2010 06:05 AM, [hidden email] wrote:

>
> Comment #6 on issue 206 by pdebruic: default String sorting differs between
> Gemstone&  Pharo
> http://code.google.com/p/glassdb/issues/detail?id=206
>
> Hi Dale,
>
> Thanks for the pointer about the Symbols. I didn't know and have removed
> them.  I'm sorry I didn't do a good job of explaining what I'm looking for.
>
> I want the array:
>        #( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' )
>
> when sorted to look like:
>        #('MM' 'Mm' 'c' 'mM' 'mb' 'mm' 'x')
>
>
> the command:
>        #( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' ) asSortedCollection: [:a :c | a
> asciiLessThan: c]
>
> does it in Gemstone and the command:
>        #( 'c' 'MM' 'Mm' 'mb' 'mM' 'mm' 'x' ) asSortedCollection
>
> does it in Pharo.  I can just add an extension #asciiLessThan: to Pharo and
> be all set.
>
>
>
>
>

Right....I looked at a better solution, but at the moment
#acissLessThan: is the best bet ... I don't know if it's worth adding
asciiLessThan: to MockGemStone (for others to use) or not ...

Dale
Reply | Threaded
Open this post in threaded view
|

Re: Issue 206 in glassdb: default String sorting differs between Gemstone & Pharo

glassdb
In reply to this post by glassdb
Updates:
        Status: Fixed
        Labels: Fixed-1.0-beta.8.7

Comment #7 on issue 206 by [hidden email]: default String sorting  
differs between Gemstone & Pharo
http://code.google.com/p/glassdb/issues/detail?id=206

add asciiLessThan: to MockGemstone ...

Name: MockGemStone-dkh.28
Author: dkh
Time: 23 March 2011, 11:46:54 am
UUID: 6f1943f4-d820-4832-854b-057be64b9934
Ancestors: MockGemStone-pmm.27