logo       

[OT] Case insensitive comparison not stable ?: msg#00140

lang.smalltalk.squeak.seaside

Subject: [OT] Case insensitive comparison not stable ?

Hello everyone !

I know this is off-topic, but at least recognize a few names here :)

Anyway, I can't seem to sort a set of objects represented by names
case insensitively. Here's what I have at the moment (some methods
omitted for brevity):

Object subclass: #Author
instanceVariableNames: 'name email messages'
classVariableNames: ''
poolDictionaries: ''
category: 'Message-Board-Model'!

<= other
^ name caseInsensitiveLessOrEqual: (other name)

Set subclass: #AuthorRepository
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Message-Board-Model'!

sortedByName
^ SortedCollection new addAll: self.

If I repeatedly "Do it" the following in the Workspace, I see the
names jumping around. Also, most of the time, Stefanny is on top,
instead of Francois ?

|ar|
ar := AuthorRepository new.
ar add: (Author new name: 'francois').
ar add: (Author new name: 'stefanny').
ar add: (Author new name: 'Kelly-anne').
Transcript clear.
ar sortedByName do: [:author | Transcript show: author name; cr.]

So, what am I doing wrong here ? I'm on Squeak 3.8. Also, for the
future, where should I be asking questions like that ? Squeak-dev ?

Thanks !
--
François Beausoleil
http://blog.teksol.info/
_______________________________________________
Seaside mailing list
Seaside@xxxxxxxxxxxxxxxxxxxxxxxxxx
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise