Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 4 participants
- 144627 messages
Re: [Pharo-project] Beeper
by Mariano Martinez Peck
>
>> And why it is a AppRegistry. AppRegistry
>>> associates some application, tool. It is very confusing to use it for
>>> a sound provider.
>>>
>> More the name of AppRegistry being confusing, what it does is provide
> infrastructure for registering providers of a service, and switching which
> is currently in use.
> In other words, SoundService (due to being an ApprRegistry) can switch
> between using multiple SoundSystems.
>
>
Would it make sense to rename AppRegistry to ServiceRegistry therefore?
> Then I do not understand why it is named
>>> AbstractSoundSystem and not simply SoundSystem (remember
>>> AbstractString).
>>>
>> Yes let us clean all that :)
>> Can you take the lead on that?
>> We could include the sound package in the release.
>>
> Because AbstractSoundSystem provides the common interface that is expected
> to be supported by a given entry in the SoundService providers . Whether
> that warrants including Abstract in the name is debatable I guess :)
>
> On Sat, Nov 17, 2012 at 9:33 PM, Stéphane Ducasse
>>> <stephane.ducasse(a)inria.fr> wrote:
>>>
>>>> Hi pavel
>>>>
>>>> In fact the registration default sound system is broken and we should
>>>> fix it.
>>>> I forgot what is the problem :)
>>>>
>>>> Hi,
>>>>>
>>>>> I would like to discuss the Beeper class a little bit. The main
>>>>> purpose of this class is to provide Beeper beep message and use
>>>>> SoundService with respect to current sound enabled settings or VM
>>>>> implemented primitive for beeping.
>>>>>
>>>> Yes this was the idea and to remove it from smalltalk.
>>>>
>>> Outright removal is a bit harsh considering what external users may
> exist.
> It probably deserves either being put in a deprecated package, or moved to
> a loadable compat package.
>
> Cheers,
> Henry
>
>
--
Mariano
http://marianopeck.wordpress.com
Nov. 20, 2012
Re: [Pharo-project] Beeper
by Henrik Sperre Johansen
The architecture involved in SoundService/AbstractSoundSystem might seem
like overkill for what is provided/used in the base image.
An external package does exist however, which provides a more capable
soundsystem when installed.
(http://www.squeaksource.com/PharoSound)
On 18.11.2012 09:47, Stéphane Ducasse wrote:
>> Hi Stef,
>>
>> firstly I do not understand why we have SoundService at all when we
>> have AbstractSoundSystem.
> Yes me too :)
>
>> And why it is a AppRegistry. AppRegistry
>> associates some application, tool. It is very confusing to use it for
>> a sound provider.
More the name of AppRegistry being confusing, what it does is provide
infrastructure for registering providers of a service, and switching
which is currently in use.
In other words, SoundService (due to being an ApprRegistry) can switch
between using multiple SoundSystems.
>> Then I do not understand why it is named
>> AbstractSoundSystem and not simply SoundSystem (remember
>> AbstractString).
> Yes let us clean all that :)
> Can you take the lead on that?
> We could include the sound package in the release.
Because AbstractSoundSystem provides the common interface that is
expected to be supported by a given entry in the SoundService providers
. Whether that warrants including Abstract in the name is debatable I
guess :)
>> On Sat, Nov 17, 2012 at 9:33 PM, Stéphane Ducasse
>> <stephane.ducasse(a)inria.fr> wrote:
>>> Hi pavel
>>>
>>> In fact the registration default sound system is broken and we should fix it.
>>> I forgot what is the problem :)
>>>
>>>> Hi,
>>>>
>>>> I would like to discuss the Beeper class a little bit. The main
>>>> purpose of this class is to provide Beeper beep message and use
>>>> SoundService with respect to current sound enabled settings or VM
>>>> implemented primitive for beeping.
>>> Yes this was the idea and to remove it from smalltalk.
Outright removal is a bit harsh considering what external users may exist.
It probably deserves either being put in a deprecated package, or moved
to a loadable compat package.
Cheers,
Henry
Nov. 20, 2012
[Pharo-project] [update 2.0] #20412
by Marcus Denker
20412
-----
Issue 7007: Package System-Change Notification is empy
http://code.google.com/p/pharo/issues/detail?id=7007
--
Marcus Denker -- http://marcusdenker.de
Nov. 20, 2012
Re: [Pharo-project] method wrappers package name problem
by Stéphane Ducasse
MIT
Stef
On Nov 19, 2012, at 5:12 PM, Noury Bouraqadi wrote:
> Hi,
>
> I tried MethodWrappers42 under Pharo 2.0-20370.
> I've got many tests turn green by simply adding CompiledMetod>>#isMwMethodWrapper that return true.
> Attached the mcz file.
>
> BTW, what is the license of this project?
>
> Noury
>
>
>
>
> Afin de contribuer au respect de l'environnement,
>
>
> merci de n'imprimer ce courriel qu'en cas de necessite
>
>
>
>
>
> Please consider the environment before you print
>
>
>
>
>
> <MethodWrappers42-NouryBouraqadi.2.mcz>
> On 16 nov. 2012, at 10:43, Tudor Girba wrote:
>
>> Hi,
>>
>> Thanks a lot. I now created another package named MethodWrappers42 (instead of MethodWrappers4.2).
>>
>> Cheers,
>> Doru
>>
>>
>> On 15 Nov 2012, at 19:03, Marcus Denker <marcus.denker(a)inria.fr> wrote:
>>
>>>
>>> On Nov 15, 2012, at 2:34 PM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> We have a little problem with MethodWrappers. Currently, the package is called MethodWrappers4.2 which completely messes up Monticello in Pharo 1.4.
>>>>
>>>> So, we (me and Stef) would like to rename it to MethodWrappers42, but for that we need access to the repository. Marcus, could you provide this access?
>>>>
>>>
>>> I actually don't know what state MW is in... there are multiple ports using multiple strategies. The 42 one is for Squeak, I think.
>>>
>>> I added you, after fighting with SqueakSource (Stef I could not find in the list)
>>>
>>> Marcus
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Marcus Denker -- http://marcusdenker.de
>>>
>>
>> --
>> www.tudorgirba.com
>>
>> "Don't give to get. Just give."
>>
>>
>>
>>
>>
>>
>
> Noury Bouraqadi
> Ecole des Mines de Douai
> http://car.mines-douai.fr/noury
> --
>
>
>
Nov. 20, 2012
Re: [Pharo-project] SortedCollection>>=
by Hernan Wilkinson
I completely agree.... your explanation is far much better than mine :-)
On Tue, Nov 20, 2012 at 2:28 AM, Igor Stasenko <siguctua(a)gmail.com> wrote:
> hmm, imo block comparison is superfluous.
> at the point of comparison, if two sorted collections happen to
> contain same elements with same order, i think, it is safe to assume
> them equal.
>
> the point is that block behavior influencing only the way how you add
> or remove elements from collection,
> as for the rest, collections will behave similar for all messages
> except from adding/deleting elements.
> but adding or deleting elements will immediately make them different,
> no matter what sort block is used.
>
>
> On 19 November 2012 16:59, Hernan Wilkinson
> <hernan.wilkinson(a)10pines.com> wrote:
> > Hi,
> > I'm a little surprised with the current SortedCollection #=
> > implementation... it is:
> >
> > = aSortedCollection
> > "Answer true if my and aSortedCollection's species are the same,
> > and if our blocks are the same, and if our elements are the same."
> >
> > self species = aSortedCollection species ifFalse: [^ false].
> > sortBlock = aSortedCollection sortBlock
> > ifTrue: [^ super = aSortedCollection]
> > ifFalse: [^ false]
> >
> > and my surprise is because it compares the sortBlocks that makes the
> > simplest case to fail like this one:
> >
> > (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
> > sortBlock: [ :a :b | a < b ])
> >
> > One could argue that if we remove the sortBlock comparison then :
> >
> > (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
> > sortBlock: [ :a :b | a > b ])
> >
> > would return true... but is that wrong? ... or is the philosophy to use
> the
> > message #hasEqualElements: on this cases?
> >
> > BTW, VisualWorks implementation is the same as pharo, but the
> > BlockClosure>>= is different and that's why it works as at least I
> expected
> > :-)
> >
> > Bye,
> > Hernan
> >
> > --
> > Hernán Wilkinson
> > Agile Software Development, Teaching & Coaching
> > Phone: +54 - 011 - 6091 - 3125
> > Mobile: +54 - 911 - 4470 - 7207
> > email: hernan.wilkinson(a)10Pines.com
> > site: http://www.10Pines.com
> > Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
> >
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>
--
*Hernán Wilkinson
Agile Software Development, Teaching & Coaching*
*Phone: +54 - 011 - *6091 - 3125*
Mobile: +54 - 911 - 4470 - 7207
email: hernan.wilkinson(a)10Pines.com
site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
Nov. 20, 2012
Re: [Pharo-project] [ANN] Limbo: a simple shell wrapper for NativeBoost
by Max Leske
On 19.11.2012, at 21:48, Igor Stasenko <siguctua(a)gmail.com> wrote:
> On 19 November 2012 17:45, Max Leske <maxleske(a)gmail.com> wrote:
>>
>> On 19.11.2012, at 21:37, Igor Stasenko <siguctua(a)gmail.com> wrote:
>>
>>> Okay, after i saw C code in limbo.c
>>> i can clearly tell, that read_buffers() function can be implemented
>>> purely on smalltalk using nativeboost.
>>>
>>> as for run_command() function, you should try to also implement it as
>>> a series of system calls using nativeboost ffi.
>>> it is possible.
>>>
>>> The most issues would be is to account for scheduler to make sure that
>>> no-one can interrupt the process between critical parts of code (like
>>> VM scheduler).
>>
>> :-/ sounds trickyâ¦
>>
> nope. this part is actually easy:
>
> [ something which should not interrupt] forkAt: Processor highestPriority.
Sweet. I'll give it a try.
>
>>>
>>> You should really consider avoiding having C code at all.. because at
>>> the end it doesn't makes things any simpler comparing to having extra
>>> VM plugin (and knowing how to deal with it - compile/copy/distribute
>>> with VM) for users.
>>>
>>
>> Good to know!
>> Now that I have a working version in C I think that it should be a lot easier to write the equivalent NativeBoost code since I know what actually to code :)
>
> Indeed. :)
>
>> It's also pretty easy to just replace the call to the library with the NB code in Limbo, so any code using the library will keep on working.
>>
>> Anybody willing to write this in NativeBoost is more than welcome, I'll have to stop working on it for the moment.
>>
>>> But anyways, good to see there's brave people who don't fear to swim
>>> in those waters :)
>>>
>>
>> Thanks :)
>>
>>> --
>>> Best regards,
>>> Igor Stasenko.
>>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
Nov. 20, 2012
Re: [Pharo-project] SortedCollection>>=
by Igor Stasenko
hmm, imo block comparison is superfluous.
at the point of comparison, if two sorted collections happen to
contain same elements with same order, i think, it is safe to assume
them equal.
the point is that block behavior influencing only the way how you add
or remove elements from collection,
as for the rest, collections will behave similar for all messages
except from adding/deleting elements.
but adding or deleting elements will immediately make them different,
no matter what sort block is used.
On 19 November 2012 16:59, Hernan Wilkinson
<hernan.wilkinson(a)10pines.com> wrote:
> Hi,
> I'm a little surprised with the current SortedCollection #=
> implementation... it is:
>
> = aSortedCollection
> "Answer true if my and aSortedCollection's species are the same,
> and if our blocks are the same, and if our elements are the same."
>
> self species = aSortedCollection species ifFalse: [^ false].
> sortBlock = aSortedCollection sortBlock
> ifTrue: [^ super = aSortedCollection]
> ifFalse: [^ false]
>
> and my surprise is because it compares the sortBlocks that makes the
> simplest case to fail like this one:
>
> (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
> sortBlock: [ :a :b | a < b ])
>
> One could argue that if we remove the sortBlock comparison then :
>
> (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
> sortBlock: [ :a :b | a > b ])
>
> would return true... but is that wrong? ... or is the philosophy to use the
> message #hasEqualElements: on this cases?
>
> BTW, VisualWorks implementation is the same as pharo, but the
> BlockClosure>>= is different and that's why it works as at least I expected
> :-)
>
> Bye,
> Hernan
>
> --
> Hernán Wilkinson
> Agile Software Development, Teaching & Coaching
> Phone: +54 - 011 - 6091 - 3125
> Mobile: +54 - 911 - 4470 - 7207
> email: hernan.wilkinson(a)10Pines.com
> site: http://www.10Pines.com
> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
>
--
Best regards,
Igor Stasenko.
Nov. 20, 2012
Re: [Pharo-project] SortedCollection>>=
by Hernán Morales Durand
You should ask Norberto Manzanos, he implemented an IdentitySolver which
mitigates the lack of these "philosophical" objects in Smalltalk.
Besides he has real experience working with objects difficult to
identify and compare.
I don't think he's willing to share it with the Pharo community, but who
knows...
Cheers,
Hernán
El 19/11/2012 21:20, Hernan Wilkinson escribió:
> I think the problem is related to the fact that different objects can
> represent the same thing, as 1/2 that represents the same "final" number
> as 2/4, but you could also say that they are different, or 1 meter and
> 100 centimeters and different measures that represent the same distance,
> and so on.
> So, an empty collection represents an empty collection no matter if it
> is a sorted one or not, and a SortedCollection with 1, 2 and 3 and
> sortblock a<b represents the same collection of elements as a
> SortedCollection with 1, 2 and 3 and block a<=b.
> The problem is that the message #= is not enough. We should have more
> messages to represent the different "equivalent relationship" where
> equality is one of it. For example, one message could be
> #representsSameEntityAs: where 1 meter and 100 centimeter would return
> true, but 1 meter = 100 centimiter would return false (but I would not
> use the #= message for that, it is confusing).
>
> Anyway, going back to the current problem, it is my opinion that with
> the current implementation of BlockClosure>>#= I would change how
> SortedCollection>>#= is implemented and use super #=
> implementation, because currently ((SortedCollection sortBlock: [:a :b |
> a < b ]) add: 1; add: 2; yourself) = ((SortedCollection sortBlock: [:a
> :b | a < b ]) add: 1; add: 2; yourself) returns false that is
> really really astonishing.... and least in other smalltalks returns true.
>
> Hernan.
>
>
> On Mon, Nov 19, 2012 at 8:27 PM, Camillo Bruni <camillobruni(a)gmail.com
> <mailto:camillobruni@gmail.com>> wrote:
>
> maybe I am just too naive, but to me this equality check is fairly
> simple:
>
> - compare inner collection
> - compare block
>
> now of course we don't have a block compare, so I wrote a simple
> approximation:
>
> - compare block args / temp size
> - compare temps
> - compare block byte codes
> - check if the blocks are Clean (no outside references)
>
> in this case it is pretty safe to assume that the blocks are equal.
>
> On 2012-11-19, at 20:15, Nicolas Cellier
> <nicolas.cellier.aka.nice(a)gmail.com
> <mailto:nicolas.cellier.aka.nice@gmail.com>> wrote:
>
> > Certainly, but whether this behavior was designed on purpose or
> > casually due to difficulty of implementing closure equality is
> hard to
> > tell.
> >
> > Even, with a "better" implementation of block closure, the notion of
> > equality is not that clear...
> > For example take
> > (SortedCollection sortBlock: [:a :b l a < b]) = (SortedCollection
> > sortBlock: [:a :b l b > a]).
> > It might well answer false, even if they will sort any Interval
> the same.
> >
> > What I wanted to emphasize was more "is there a natural/canocical
> > definition of object equality"
> > If yes, I'm very interested, but I don't think so.
> > If not, then we happen to have a collection of arbitrary definitions
> > of equality.
> > So, the question whether one definition is better than the other is
> > difficult to answer.
> > That's what I call interesting.
> > I doubt we have explicit rationale, well written tests or
> standards (I
> > didn't check ANSI) specifying the behaviour...
> > We just have principles of least astonishment and principles of
> > utility (is it used in the image, is it vital, etc...).
> >
> > Nicolas
> >
> > 2012/11/19 Frank Shearar <frank.shearar(a)gmail.com
> <mailto:frank.shearar@gmail.com>>:
> >> I would guess because there is no general equality for anonymous
> functions.
> >> If the two collections used the same block (as opposed to
> equivalent blocks)
> >> I'd expect them to be =.
> >>
> >> frank
> >>
> >> On 19 Nov 2012, at 21:59, Hernan Wilkinson
> <hernan.wilkinson(a)10pines.com <mailto:hernan.wilkinson@10pines.com>>
> >> wrote:
> >>
> >> Interesting...
> >>
> >> But then why (SortedCollection sortBlock: [ :a :b | a < b ]) =
> >> (SortedCollection sortBlock: [ :a :b | a < b ]) should return false?
> >>
> >> Hernan
> >>
> >>
> >> On Mon, Nov 19, 2012 at 5:54 PM, Nicolas Cellier
> >> <nicolas.cellier.aka.nice(a)gmail.com
> <mailto:nicolas.cellier.aka.nice@gmail.com>> wrote:
> >>>
> >>> Interesting...
> >>>
> >>> We could ask such questions too with definition of
> >>> - Heap equality (since they are partially sorted...)
> >>> (Heap withAll: (1 to: 10) asArray) = (Heap withAll: (1 to: 10)
> >>> asArray shuffled).
> >>> - Interval equality, could you tell me which one is true?
> >>> (3 to: 2) = (2 to: 1).
> >>> (1 to: 7 by: 2) = (1 to: 8 by: 2).
> >>> (1 to: 2 by: 2) = (1 to: 2 by: 3).
> >>>
> >>> Nicolas
> >>>
> >>> 2012/11/19 Hernan Wilkinson <hernan.wilkinson(a)10pines.com
> <mailto:hernan.wilkinson@10pines.com>>:
> >>>> Hi,
> >>>> I'm a little surprised with the current SortedCollection #=
> >>>> implementation... it is:
> >>>>
> >>>> = aSortedCollection
> >>>> "Answer true if my and aSortedCollection's species are the same,
> >>>> and if our blocks are the same, and if our elements are the same."
> >>>>
> >>>> self species = aSortedCollection species ifFalse: [^ false].
> >>>> sortBlock = aSortedCollection sortBlock
> >>>> ifTrue: [^ super = aSortedCollection]
> >>>> ifFalse: [^ false]
> >>>>
> >>>> and my surprise is because it compares the sortBlocks that
> makes the
> >>>> simplest case to fail like this one:
> >>>>
> >>>> (SortedCollection sortBlock: [ :a :b | a < b ]) =
> (SortedCollection
> >>>> sortBlock: [ :a :b | a < b ])
> >>>>
> >>>> One could argue that if we remove the sortBlock comparison then :
> >>>>
> >>>> (SortedCollection sortBlock: [ :a :b | a < b ]) =
> (SortedCollection
> >>>> sortBlock: [ :a :b | a > b ])
> >>>>
> >>>> would return true... but is that wrong? ... or is the
> philosophy to use
> >>>> the
> >>>> message #hasEqualElements: on this cases?
> >>>>
> >>>> BTW, VisualWorks implementation is the same as pharo, but the
> >>>> BlockClosure>>= is different and that's why it works as at least I
> >>>> expected
> >>>> :-)
> >>>>
> >>>> Bye,
> >>>> Hernan
> >>>>
> >>>> --
> >>>> Hernán Wilkinson
> >>>> Agile Software Development, Teaching & Coaching
> >>>> Phone: +54 - 011 - 6091 - 3125
> >>>> Mobile: +54 - 911 - 4470 - 7207
> >>>> email: hernan.wilkinson(a)10Pines.com
> >>>> site: http://www.10Pines.com
> >>>> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
> >>>>
> >>>
> >>
> >>
> >>
> >> --
> >> Hernán Wilkinson
> >> Agile Software Development, Teaching & Coaching
> >> Phone: +54 - 011 - 6091 - 3125
> >> Mobile: +54 - 911 - 4470 - 7207
> >> email: hernan.wilkinson(a)10Pines.com
> >> site: http://www.10Pines.com
> >> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
> >>
> >
>
>
>
>
>
> --
> *Hernán Wilkinson
> Agile Software Development, Teaching & Coaching*
> *Phone: +54 - 011 - *6091 - 3125*
> Mobile: +54 - 911 - 4470 - 7207
> email: hernan.wilkinson(a)10Pines.com
> site: http://www.10Pines.com <http://www.10pines.com/>*
> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
>
Nov. 20, 2012
Re: [Pharo-project] SortedCollection>>=
by Hernan Wilkinson
I think the problem is related to the fact that different objects can
represent the same thing, as 1/2 that represents the same "final" number as
2/4, but you could also say that they are different, or 1 meter and 100
centimeters and different measures that represent the same distance, and so
on.
So, an empty collection represents an empty collection no matter if it is a
sorted one or not, and a SortedCollection with 1, 2 and 3 and sortblock a<b
represents the same collection of elements as a SortedCollection with 1, 2
and 3 and block a<=b.
The problem is that the message #= is not enough. We should have more
messages to represent the different "equivalent relationship" where
equality is one of it. For example, one message could be
#representsSameEntityAs: where 1 meter and 100 centimeter would return
true, but 1 meter = 100 centimiter would return false (but I would not use
the #= message for that, it is confusing).
Anyway, going back to the current problem, it is my opinion that with the
current implementation of BlockClosure>>#= I would change how
SortedCollection>>#= is implemented and use super #=
implementation, because currently ((SortedCollection sortBlock: [:a :b | a
< b ]) add: 1; add: 2; yourself) = ((SortedCollection sortBlock: [:a :b | a
< b ]) add: 1; add: 2; yourself) returns false that is really really
astonishing.... and least in other smalltalks returns true.
Hernan.
On Mon, Nov 19, 2012 at 8:27 PM, Camillo Bruni <camillobruni(a)gmail.com>wrote:
> maybe I am just too naive, but to me this equality check is fairly simple:
>
> - compare inner collection
> - compare block
>
> now of course we don't have a block compare, so I wrote a simple
> approximation:
>
> - compare block args / temp size
> - compare temps
> - compare block byte codes
> - check if the blocks are Clean (no outside references)
>
> in this case it is pretty safe to assume that the blocks are equal.
>
> On 2012-11-19, at 20:15, Nicolas Cellier <
> nicolas.cellier.aka.nice(a)gmail.com> wrote:
>
> > Certainly, but whether this behavior was designed on purpose or
> > casually due to difficulty of implementing closure equality is hard to
> > tell.
> >
> > Even, with a "better" implementation of block closure, the notion of
> > equality is not that clear...
> > For example take
> > (SortedCollection sortBlock: [:a :b l a < b]) = (SortedCollection
> > sortBlock: [:a :b l b > a]).
> > It might well answer false, even if they will sort any Interval the same.
> >
> > What I wanted to emphasize was more "is there a natural/canocical
> > definition of object equality"
> > If yes, I'm very interested, but I don't think so.
> > If not, then we happen to have a collection of arbitrary definitions
> > of equality.
> > So, the question whether one definition is better than the other is
> > difficult to answer.
> > That's what I call interesting.
> > I doubt we have explicit rationale, well written tests or standards (I
> > didn't check ANSI) specifying the behaviour...
> > We just have principles of least astonishment and principles of
> > utility (is it used in the image, is it vital, etc...).
> >
> > Nicolas
> >
> > 2012/11/19 Frank Shearar <frank.shearar(a)gmail.com>:
> >> I would guess because there is no general equality for anonymous
> functions.
> >> If the two collections used the same block (as opposed to equivalent
> blocks)
> >> I'd expect them to be =.
> >>
> >> frank
> >>
> >> On 19 Nov 2012, at 21:59, Hernan Wilkinson <
> hernan.wilkinson(a)10pines.com>
> >> wrote:
> >>
> >> Interesting...
> >>
> >> But then why (SortedCollection sortBlock: [ :a :b | a < b ]) =
> >> (SortedCollection sortBlock: [ :a :b | a < b ]) should return false?
> >>
> >> Hernan
> >>
> >>
> >> On Mon, Nov 19, 2012 at 5:54 PM, Nicolas Cellier
> >> <nicolas.cellier.aka.nice(a)gmail.com> wrote:
> >>>
> >>> Interesting...
> >>>
> >>> We could ask such questions too with definition of
> >>> - Heap equality (since they are partially sorted...)
> >>> (Heap withAll: (1 to: 10) asArray) = (Heap withAll: (1 to: 10)
> >>> asArray shuffled).
> >>> - Interval equality, could you tell me which one is true?
> >>> (3 to: 2) = (2 to: 1).
> >>> (1 to: 7 by: 2) = (1 to: 8 by: 2).
> >>> (1 to: 2 by: 2) = (1 to: 2 by: 3).
> >>>
> >>> Nicolas
> >>>
> >>> 2012/11/19 Hernan Wilkinson <hernan.wilkinson(a)10pines.com>:
> >>>> Hi,
> >>>> I'm a little surprised with the current SortedCollection #=
> >>>> implementation... it is:
> >>>>
> >>>> = aSortedCollection
> >>>> "Answer true if my and aSortedCollection's species are the same,
> >>>> and if our blocks are the same, and if our elements are the same."
> >>>>
> >>>> self species = aSortedCollection species ifFalse: [^ false].
> >>>> sortBlock = aSortedCollection sortBlock
> >>>> ifTrue: [^ super = aSortedCollection]
> >>>> ifFalse: [^ false]
> >>>>
> >>>> and my surprise is because it compares the sortBlocks that makes the
> >>>> simplest case to fail like this one:
> >>>>
> >>>> (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
> >>>> sortBlock: [ :a :b | a < b ])
> >>>>
> >>>> One could argue that if we remove the sortBlock comparison then :
> >>>>
> >>>> (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
> >>>> sortBlock: [ :a :b | a > b ])
> >>>>
> >>>> would return true... but is that wrong? ... or is the philosophy to
> use
> >>>> the
> >>>> message #hasEqualElements: on this cases?
> >>>>
> >>>> BTW, VisualWorks implementation is the same as pharo, but the
> >>>> BlockClosure>>= is different and that's why it works as at least I
> >>>> expected
> >>>> :-)
> >>>>
> >>>> Bye,
> >>>> Hernan
> >>>>
> >>>> --
> >>>> Hernán Wilkinson
> >>>> Agile Software Development, Teaching & Coaching
> >>>> Phone: +54 - 011 - 6091 - 3125
> >>>> Mobile: +54 - 911 - 4470 - 7207
> >>>> email: hernan.wilkinson(a)10Pines.com
> >>>> site: http://www.10Pines.com
> >>>> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
> >>>>
> >>>
> >>
> >>
> >>
> >> --
> >> Hernán Wilkinson
> >> Agile Software Development, Teaching & Coaching
> >> Phone: +54 - 011 - 6091 - 3125
> >> Mobile: +54 - 911 - 4470 - 7207
> >> email: hernan.wilkinson(a)10Pines.com
> >> site: http://www.10Pines.com
> >> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
> >>
> >
>
>
>
--
*Hernán Wilkinson
Agile Software Development, Teaching & Coaching*
*Phone: +54 - 011 - *6091 - 3125*
Mobile: +54 - 911 - 4470 - 7207
email: hernan.wilkinson(a)10Pines.com
site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
Nov. 20, 2012
Re: [Pharo-project] SortedCollection>>=
by Camillo Bruni
maybe I am just too naive, but to me this equality check is fairly simple:
- compare inner collection
- compare block
now of course we don't have a block compare, so I wrote a simple approximation:
- compare block args / temp size
- compare temps
- compare block byte codes
- check if the blocks are Clean (no outside references)
in this case it is pretty safe to assume that the blocks are equal.
On 2012-11-19, at 20:15, Nicolas Cellier <nicolas.cellier.aka.nice(a)gmail.com> wrote:
> Certainly, but whether this behavior was designed on purpose or
> casually due to difficulty of implementing closure equality is hard to
> tell.
>
> Even, with a "better" implementation of block closure, the notion of
> equality is not that clear...
> For example take
> (SortedCollection sortBlock: [:a :b l a < b]) = (SortedCollection
> sortBlock: [:a :b l b > a]).
> It might well answer false, even if they will sort any Interval the same.
>
> What I wanted to emphasize was more "is there a natural/canocical
> definition of object equality"
> If yes, I'm very interested, but I don't think so.
> If not, then we happen to have a collection of arbitrary definitions
> of equality.
> So, the question whether one definition is better than the other is
> difficult to answer.
> That's what I call interesting.
> I doubt we have explicit rationale, well written tests or standards (I
> didn't check ANSI) specifying the behaviour...
> We just have principles of least astonishment and principles of
> utility (is it used in the image, is it vital, etc...).
>
> Nicolas
>
> 2012/11/19 Frank Shearar <frank.shearar(a)gmail.com>:
>> I would guess because there is no general equality for anonymous functions.
>> If the two collections used the same block (as opposed to equivalent blocks)
>> I'd expect them to be =.
>>
>> frank
>>
>> On 19 Nov 2012, at 21:59, Hernan Wilkinson <hernan.wilkinson(a)10pines.com>
>> wrote:
>>
>> Interesting...
>>
>> But then why (SortedCollection sortBlock: [ :a :b | a < b ]) =
>> (SortedCollection sortBlock: [ :a :b | a < b ]) should return false?
>>
>> Hernan
>>
>>
>> On Mon, Nov 19, 2012 at 5:54 PM, Nicolas Cellier
>> <nicolas.cellier.aka.nice(a)gmail.com> wrote:
>>>
>>> Interesting...
>>>
>>> We could ask such questions too with definition of
>>> - Heap equality (since they are partially sorted...)
>>> (Heap withAll: (1 to: 10) asArray) = (Heap withAll: (1 to: 10)
>>> asArray shuffled).
>>> - Interval equality, could you tell me which one is true?
>>> (3 to: 2) = (2 to: 1).
>>> (1 to: 7 by: 2) = (1 to: 8 by: 2).
>>> (1 to: 2 by: 2) = (1 to: 2 by: 3).
>>>
>>> Nicolas
>>>
>>> 2012/11/19 Hernan Wilkinson <hernan.wilkinson(a)10pines.com>:
>>>> Hi,
>>>> I'm a little surprised with the current SortedCollection #=
>>>> implementation... it is:
>>>>
>>>> = aSortedCollection
>>>> "Answer true if my and aSortedCollection's species are the same,
>>>> and if our blocks are the same, and if our elements are the same."
>>>>
>>>> self species = aSortedCollection species ifFalse: [^ false].
>>>> sortBlock = aSortedCollection sortBlock
>>>> ifTrue: [^ super = aSortedCollection]
>>>> ifFalse: [^ false]
>>>>
>>>> and my surprise is because it compares the sortBlocks that makes the
>>>> simplest case to fail like this one:
>>>>
>>>> (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
>>>> sortBlock: [ :a :b | a < b ])
>>>>
>>>> One could argue that if we remove the sortBlock comparison then :
>>>>
>>>> (SortedCollection sortBlock: [ :a :b | a < b ]) = (SortedCollection
>>>> sortBlock: [ :a :b | a > b ])
>>>>
>>>> would return true... but is that wrong? ... or is the philosophy to use
>>>> the
>>>> message #hasEqualElements: on this cases?
>>>>
>>>> BTW, VisualWorks implementation is the same as pharo, but the
>>>> BlockClosure>>= is different and that's why it works as at least I
>>>> expected
>>>> :-)
>>>>
>>>> Bye,
>>>> Hernan
>>>>
>>>> --
>>>> Hernán Wilkinson
>>>> Agile Software Development, Teaching & Coaching
>>>> Phone: +54 - 011 - 6091 - 3125
>>>> Mobile: +54 - 911 - 4470 - 7207
>>>> email: hernan.wilkinson(a)10Pines.com
>>>> site: http://www.10Pines.com
>>>> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
>>>>
>>>
>>
>>
>>
>> --
>> Hernán Wilkinson
>> Agile Software Development, Teaching & Coaching
>> Phone: +54 - 011 - 6091 - 3125
>> Mobile: +54 - 911 - 4470 - 7207
>> email: hernan.wilkinson(a)10Pines.com
>> site: http://www.10Pines.com
>> Address: Alem 693, Floor 5 B, Buenos Aires, Argentina
>>
>
Nov. 19, 2012