Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- 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
October 2014
- 94 participants
- 1300 messages
Re: [Pharo-dev] [ANN] New Gold Member LabWare
by Sven Van Caekenberghe
This is excellent news.
On 15 Oct 2014, at 14:00, Marcus Denker <marcus.denker(a)inria.fr> wrote:
> The Pharo Consortium is very happy to announce that LabWare has joined the Consortium as a Gold Industrial Member.
>
> About LabWare:
> "LabWare is recognized as the global leader in providing enterprise scale laboratory automation solutions.
> Our Enterprise Laboratory Platform combines the award-winning LabWare LIMS⢠and LabWare ELNâ¢, a
> comprehensive and fully integrated Electronic Laboratory Notebook application, which enables companies
> to optimize compliance, improve quality, increase productivity and reduce costs. LabWare is a full service
> provider offering software, professional implementation services and validation assistance, training, and
> world class technical support to ensure our customers get the maximum value from their LabWare products."
>
> - LabWare: http://www.labware.com
> - Pharo Consortium: http://consortium.pharo.org
>
> The goal of the Pharo Consortium is to allow companies to support the ongoing development and future of Pharo.
> Individuals can support Pharo via the Pharo Association: http://association.pharo.org
Oct. 17, 2014
Question on Package comments [SO]
by Nicolai Hess
There was a question on SO about documentations for Packages:
http://stackoverflow.com/questions/26292060/is-there-any-pharo-package-refe…
I don't have enough reputation for adding comments in SO,
therefore, I ask the questions here:
The question is closed and I don't understand why.
It is a valid question and I do
remember that this was a topic on this list as well:
show document/help text in configuration browser/
tooltip for packages in Nautilus/
comment package like it is done for classes.
For that user, who asked the question on SO:
At least for external packages there are sometimes some
information on github or squeaksource and we should show him
a link to the pharo user mailing list.
(and no, the http://lmgtfy.com/ link is not helpful nor funny)
nicolai
Oct. 17, 2014
Re: [Pharo-dev] PharoNOS
by mikefilonov
I have updated the ISO
- Changed the disk setup - now it is more safe - it finds first disk without
a partition table and use it for persistance. If no such disk found ISO
works from memory.
- Added PharoLaucher as a default Image
- Added sqlite3 driver (not test yet though)
- Made Pharo run by root user so all files are editable now
I was not able to fix AioPlugin as seems there is no compiled version for
Linux.
Please check the new ISO out and share your feedback.
You may get the ISO here:
https://drive.google.com/folderview?id=0B7FTL05bnHyud2lCWHN0LUdTd1E&usp=sha…
"pharonos 2.iso"
--
View this message in context: http://forum.world.st/PharoNOS-tp4784982p4785187.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Max Leske
> On 17.10.2014, at 16:41, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi Max,
>
> On Oct 17, 2014, at 7:24 AM, Max Leske <maxleske(a)gmail.com <mailto:maxleske@gmail.com>> wrote:
>
>>
>>> On 17.10.2014, at 15:52, Nicolas Cellier <nicolas.cellier.aka.nice(a)gmail.com <mailto:nicolas.cellier.aka.nice@gmail.com>> wrote:
>>>
>>>
>>>
>>> 2014-10-17 15:49 GMT+02:00 Max Leske <maxleske(a)gmail.com <mailto:maxleske@gmail.com>>:
>>>
>>>> On 17.10.2014, at 15:25, Eliot Miranda <eliot.miranda(a)gmail.com <mailto:eliot.miranda@gmail.com>> wrote:
>>>>
>>>> Hi Max,
>>>>
>>>> On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com <mailto:maxleske@gmail.com>> wrote:
>>>>
>>>>>
>>>>>> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com <mailto:btc@openInWorld.com>> wrote:
>>>>>>
>>>>>> Richard Sargent wrote:
>>>>>>> Eliot Miranda-2 wrote
>>>>>>>> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>>>>>>>> richard.sargent@
>>>>>>>>> wrote:
>>>>>>>>> One of the best things about Smalltalk is how easily we can say what we
>>>>>>>>> mean. I think you would be better off creating a method named something
>>>>>>>>> like
>>>>>>>>> #hasSameEffectAs: to answer what you are presently using #= to do, and
>>>>>>>>> change #= to answer the, in my opinion, more sensible "is the same as"
>>>>>>>>> that
>>>>>>>>> we conventionally think of #= meaning.
>>>>>>>>>
>>>>>>>> But that's the point. #= has to mean something and having it mean #==
>>>>>>>> isn't useful, so one has to choose some value-based semantic for
>>>>>>>> CompiledMethod>>#= and the one that's there is useful. Defining what #=
>>>>>>>> means for some value type is far easier than defining what it might mean
>>>>>>>> for something as complex as a CompiledMethod. The definition in
>>>>>>>> Squeak/Pharo has been useful to me in implementing a closure-based system,
>>>>>>>> so I'm unapologetic about the current definition. It is a good one but it
>>>>>>>> doesn't preclude defining others.
>>>>>>> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
>>>>>>> provides greater clarity and add an argument against something I didn't say.
>>>>>>> I also don't think defining equality for a CompiledMethod is particularly
>>>>>>> difficult. If I were to recompile a method's source code, I would get a new
>>>>>>> instance of a CompiledMethod that would, in my opinion, be equal to the one
>>>>>>> already installed in the class (and perhaps cached in the VM's
>>>>>>> optimizations). So one would be able to say that we would not replace an
>>>>>>> existing CompiledMethod with an equal one. The current implementation of #=
>>>>>>> has no such characteristic, since it proclaims a CompiledMethod named #a to
>>>>>>> be equal to one named #z.
>>>>>>
>>>>>> @Richard
>>>>>>
>>>>>> That doesn't seem to be a good example for what your trying to say.
>>>>>> Given...
>>>>>>
>>>>>> [1] SomeClass>>a "original instance"
>>>>>> ^1
>>>>>>
>>>>>> [2] SomeClass>>a "recompiled instance"
>>>>>> ^1
>>>>>>
>>>>>> [3] SomeClass>>z
>>>>>> ^1
>>>>>>
>>>>>> ...you seem to be saying that its useful to know if [1]=[2],
>>>>>> but imply that is invalidated by [2]=[3] ?
>>>>>>
>>>>>> But [1]=[2] remains true, and just as useful for your example.
>>>>>>
>>>>>>
>>>>>> @Max
>>>>>>
>>>>>> I guess to call it a bug, you bumped into a different use case
>>>>>> where [2]=[3] is problematic. Can you describe that?
>>>>>
>>>>> Well, not problematic. Once you accept that neither selector nor class are part of a CompiledMethod it is obvious that two instances with the same byte codes produce the same hash.
>>>>>
>>>>> The actual problem is more one of understanding and use. The following code answers a collection with the CompiledMethods Collection>>add:, Collection>>do: and Collection>>remove:ifAbsent:
>>>>>
>>>>> Collection methods select: #isAbstract.
>>>>>
>>>>> All three CompiledMethods are implemented as â^ self subclassResponsibilityâ, so they have the same byte codes. Now, if you take that collection and make a set out of it youâll lose Collection>>do: since #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because the number of arguments is calculated into the hash (actually the CompiledMethod header is).
>>>>
>>>> Surely the issue is that "aClass methods" should answer an IdentitySet right?
>>>
>>> Well, in the case of my example that wouldnât change anything. As soon as you put the methods into a set youâll end up with less entries than before again. Selectors are unique per class anyway so I donât quite see the benefit of using an IdentitySet over an OrderedCollection (or a Bag for that matter), except for making it more obvious that the result of the message #methods doesnât need to be filtered further.
>>>
>>> I should add that the code, the student who discovered the clash wrote, looked more like this:
>>>
>>> result := Set new.
>>> Collection methods do: [ :m |
>>> m isAbstract ifTrue: [ result add: m ] ].
>>>
>>> Max
>>>
>>>
>>> Why not just keep a dictionary, like methodDictionary select: #isAbstract or something like thatâ¦
>>
>> Youâre right of course, thereâs no need to put methods into a set. The code is from an exercise and the students arenât used to Smalltalk, so they end up with all sorts of code.
>
> And so they learn...
>
:p
>
>>>>> So, as long as you think of CompiledMethods as objects that have a name, it looks like a bug and in my opinion this behaviour is something that messes with the mind of newcomers. Just a (silly) idea: something like a CompiledMethodWrapper might solve the problem (at least from the user perspective; everything is slightly different from the VM perspective :) ), as it could hold on to the class and the selector independently of the actual CompiledMethod.
>>>>>
>>>>> In the end however, one doesnât work with compiled methods a lot and the hash situation is unlikely to cause a lot of problems (people working with CompiledMethod usually know what they are doing).
>>>>>
>>>>> Cheers,
>>>>> Max
>>>>>
>>>>>>
>>>>>>
>>>>>> cheers -ben
>>>>>>
>>>>>>
>>>>>>> The blue book say #= means "Answer whether the receiver and the argument
>>>>>>> represent the same component." The current implementation does so only for
>>>>>>> some, in my opinion, counter-intuitive definition of "same component".
>>>>>>> --
>>>>>>> View this message in context: http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478… <http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…>
>>>>>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com <http://nabble.com/>.
>>>>
>>>> Eliot (phone)
>
>
> Eliot (phone)
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Eliot Miranda
Hi Max,
On Oct 17, 2014, at 7:24 AM, Max Leske <maxleske(a)gmail.com> wrote:
>
>> On 17.10.2014, at 15:52, Nicolas Cellier <nicolas.cellier.aka.nice(a)gmail.com> wrote:
>>
>>
>>
>> 2014-10-17 15:49 GMT+02:00 Max Leske <maxleske(a)gmail.com>:
>>>
>>>> On 17.10.2014, at 15:25, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>>>
>>>> Hi Max,
>>>>
>>>> On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com> wrote:
>>>>
>>>>>
>>>>>> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com> wrote:
>>>>>>
>>>>>> Richard Sargent wrote:
>>>>>>> Eliot Miranda-2 wrote
>>>>>>>> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>>>>>>>> richard.sargent@
>>>>>>>>> wrote:
>>>>>>>>> One of the best things about Smalltalk is how easily we can say what we
>>>>>>>>> mean. I think you would be better off creating a method named something
>>>>>>>>> like
>>>>>>>>> #hasSameEffectAs: to answer what you are presently using #= to do, and
>>>>>>>>> change #= to answer the, in my opinion, more sensible "is the same as"
>>>>>>>>> that
>>>>>>>>> we conventionally think of #= meaning.
>>>>>>>> But that's the point. #= has to mean something and having it mean #==
>>>>>>>> isn't useful, so one has to choose some value-based semantic for
>>>>>>>> CompiledMethod>>#= and the one that's there is useful. Defining what #=
>>>>>>>> means for some value type is far easier than defining what it might mean
>>>>>>>> for something as complex as a CompiledMethod. The definition in
>>>>>>>> Squeak/Pharo has been useful to me in implementing a closure-based system,
>>>>>>>> so I'm unapologetic about the current definition. It is a good one but it
>>>>>>>> doesn't preclude defining others.
>>>>>>> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
>>>>>>> provides greater clarity and add an argument against something I didn't say.
>>>>>>> I also don't think defining equality for a CompiledMethod is particularly
>>>>>>> difficult. If I were to recompile a method's source code, I would get a new
>>>>>>> instance of a CompiledMethod that would, in my opinion, be equal to the one
>>>>>>> already installed in the class (and perhaps cached in the VM's
>>>>>>> optimizations). So one would be able to say that we would not replace an
>>>>>>> existing CompiledMethod with an equal one. The current implementation of #=
>>>>>>> has no such characteristic, since it proclaims a CompiledMethod named #a to
>>>>>>> be equal to one named #z.
>>>>>>
>>>>>> @Richard
>>>>>>
>>>>>> That doesn't seem to be a good example for what your trying to say.
>>>>>> Given...
>>>>>>
>>>>>> [1] SomeClass>>a "original instance"
>>>>>> ^1
>>>>>>
>>>>>> [2] SomeClass>>a "recompiled instance"
>>>>>> ^1
>>>>>>
>>>>>> [3] SomeClass>>z
>>>>>> ^1
>>>>>>
>>>>>> ...you seem to be saying that its useful to know if [1]=[2],
>>>>>> but imply that is invalidated by [2]=[3] ?
>>>>>>
>>>>>> But [1]=[2] remains true, and just as useful for your example.
>>>>>>
>>>>>>
>>>>>> @Max
>>>>>>
>>>>>> I guess to call it a bug, you bumped into a different use case
>>>>>> where [2]=[3] is problematic. Can you describe that?
>>>>>
>>>>> Well, not problematic. Once you accept that neither selector nor class are part of a CompiledMethod it is obvious that two instances with the same byte codes produce the same hash.
>>>>>
>>>>> The actual problem is more one of understanding and use. The following code answers a collection with the CompiledMethods Collection>>add:, Collection>>do: and Collection>>remove:ifAbsent:
>>>>>
>>>>> Collection methods select: #isAbstract.
>>>>>
>>>>> All three CompiledMethods are implemented as â^ self subclassResponsibilityâ, so they have the same byte codes. Now, if you take that collection and make a set out of it youâll lose Collection>>do: since #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because the number of arguments is calculated into the hash (actually the CompiledMethod header is).
>>>>
>>>> Surely the issue is that "aClass methods" should answer an IdentitySet right?
>>>
>>> Well, in the case of my example that wouldnât change anything. As soon as you put the methods into a set youâll end up with less entries than before again. Selectors are unique per class anyway so I donât quite see the benefit of using an IdentitySet over an OrderedCollection (or a Bag for that matter), except for making it more obvious that the result of the message #methods doesnât need to be filtered further.
>>>
>>> I should add that the code, the student who discovered the clash wrote, looked more like this:
>>>
>>> result := Set new.
>>> Collection methods do: [ :m |
>>> m isAbstract ifTrue: [ result add: m ] ].
>>>
>>> Max
>>
>> Why not just keep a dictionary, like methodDictionary select: #isAbstract or something like thatâ¦
>
> Youâre right of course, thereâs no need to put methods into a set. The code is from an exercise and the students arenât used to Smalltalk, so they end up with all sorts of code.
And so they learn...
>>>>> So, as long as you think of CompiledMethods as objects that have a name, it looks like a bug and in my opinion this behaviour is something that messes with the mind of newcomers. Just a (silly) idea: something like a CompiledMethodWrapper might solve the problem (at least from the user perspective; everything is slightly different from the VM perspective :) ), as it could hold on to the class and the selector independently of the actual CompiledMethod.
>>>>>
>>>>> In the end however, one doesnât work with compiled methods a lot and the hash situation is unlikely to cause a lot of problems (people working with CompiledMethod usually know what they are doing).
>>>>>
>>>>> Cheers,
>>>>> Max
>>>>>
>>>>>>
>>>>>>
>>>>>> cheers -ben
>>>>>>
>>>>>>
>>>>>>> The blue book say #= means "Answer whether the receiver and the argument
>>>>>>> represent the same component." The current implementation does so only for
>>>>>>> some, in my opinion, counter-intuitive definition of "same component".
>>>>>>> --
>>>>>>> View this message in context: http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…
>>>>>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>>>
>>>> Eliot (phone)
Eliot (phone)
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Eliot Miranda
Hi Max,
On Oct 17, 2014, at 6:49 AM, Max Leske <maxleske(a)gmail.com> wrote:
>
>> On 17.10.2014, at 15:25, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>
>> Hi Max,
>>
>> On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com> wrote:
>>
>>>
>>>> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com> wrote:
>>>>
>>>> Richard Sargent wrote:
>>>>> Eliot Miranda-2 wrote
>>>>>> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>>>>>> richard.sargent@
>>>>>>> wrote:
>>>>>>> One of the best things about Smalltalk is how easily we can say what we
>>>>>>> mean. I think you would be better off creating a method named something
>>>>>>> like
>>>>>>> #hasSameEffectAs: to answer what you are presently using #= to do, and
>>>>>>> change #= to answer the, in my opinion, more sensible "is the same as"
>>>>>>> that
>>>>>>> we conventionally think of #= meaning.
>>>>>> But that's the point. #= has to mean something and having it mean #==
>>>>>> isn't useful, so one has to choose some value-based semantic for
>>>>>> CompiledMethod>>#= and the one that's there is useful. Defining what #=
>>>>>> means for some value type is far easier than defining what it might mean
>>>>>> for something as complex as a CompiledMethod. The definition in
>>>>>> Squeak/Pharo has been useful to me in implementing a closure-based system,
>>>>>> so I'm unapologetic about the current definition. It is a good one but it
>>>>>> doesn't preclude defining others.
>>>>> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
>>>>> provides greater clarity and add an argument against something I didn't say.
>>>>> I also don't think defining equality for a CompiledMethod is particularly
>>>>> difficult. If I were to recompile a method's source code, I would get a new
>>>>> instance of a CompiledMethod that would, in my opinion, be equal to the one
>>>>> already installed in the class (and perhaps cached in the VM's
>>>>> optimizations). So one would be able to say that we would not replace an
>>>>> existing CompiledMethod with an equal one. The current implementation of #=
>>>>> has no such characteristic, since it proclaims a CompiledMethod named #a to
>>>>> be equal to one named #z.
>>>>
>>>> @Richard
>>>>
>>>> That doesn't seem to be a good example for what your trying to say.
>>>> Given...
>>>>
>>>> [1] SomeClass>>a "original instance"
>>>> ^1
>>>>
>>>> [2] SomeClass>>a "recompiled instance"
>>>> ^1
>>>>
>>>> [3] SomeClass>>z
>>>> ^1
>>>>
>>>> ...you seem to be saying that its useful to know if [1]=[2],
>>>> but imply that is invalidated by [2]=[3] ?
>>>>
>>>> But [1]=[2] remains true, and just as useful for your example.
>>>>
>>>>
>>>> @Max
>>>>
>>>> I guess to call it a bug, you bumped into a different use case
>>>> where [2]=[3] is problematic. Can you describe that?
>>>
>>> Well, not problematic. Once you accept that neither selector nor class are part of a CompiledMethod it is obvious that two instances with the same byte codes produce the same hash.
>>>
>>> The actual problem is more one of understanding and use. The following code answers a collection with the CompiledMethods Collection>>add:, Collection>>do: and Collection>>remove:ifAbsent:
>>>
>>> Collection methods select: #isAbstract.
>>>
>>> All three CompiledMethods are implemented as â^ self subclassResponsibilityâ, so they have the same byte codes. Now, if you take that collection and make a set out of it youâll lose Collection>>do: since #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because the number of arguments is calculated into the hash (actually the CompiledMethod header is).
>>
>> Surely the issue is that "aClass methods" should answer an IdentitySet right?
>
> Well, in the case of my example that wouldnât change anything. As soon as you put the methods into a set youâll end up with less entries than before again.
No. An IdentitySet uses #== and identityHash so that won't be the case. Also IIRC. anIdentitySet collect: answers another IdentitySet.
> Selectors are unique per class anyway so I donât quite see the benefit of using an IdentitySet over an OrderedCollection (or a Bag for that matter), except for making it more obvious that the result of the message #methods doesnât need to be filtered further.
Well then (IdentitySet withAll: aClass methods) collect: will not lose elements. You'd have exactly the same issue if you tried to collect the set of all literals in the system. Unless you used an IdentitySet you'd collect only the different values, not all literals. Or any set of all objects that represent values.
> I should add that the code, the student who discovered the clash wrote, looked more like this:
>
> result := Set new.
> Collection methods do: [ :m |
> m isAbstract ifTrue: [ result add: m ] ].
So change it to IdentitySet new. This is good for the student to encounter. It is one of the essential differences between OO and functional languages. We have state and identity.
> Max
>
>>
>>
>>> So, as long as you think of CompiledMethods as objects that have a name, it looks like a bug and in my opinion this behaviour is something that messes with the mind of newcomers. Just a (silly) idea: something like a CompiledMethodWrapper might solve the problem (at least from the user perspective; everything is slightly different from the VM perspective :) ), as it could hold on to the class and the selector independently of the actual CompiledMethod.
>>>
>>> In the end however, one doesnât work with compiled methods a lot and the hash situation is unlikely to cause a lot of problems (people working with CompiledMethod usually know what they are doing).
>>>
>>> Cheers,
>>> Max
>>>
>>>>
>>>>
>>>> cheers -ben
>>>>
>>>>
>>>>> The blue book say #= means "Answer whether the receiver and the argument
>>>>> represent the same component." The current implementation does so only for
>>>>> some, in my opinion, counter-intuitive definition of "same component".
>>>>> --
>>>>> View this message in context: http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…
>>>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>
>> Eliot (phone)
Cheers,
Eliot
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Max Leske
> On 17.10.2014, at 15:52, Nicolas Cellier <nicolas.cellier.aka.nice(a)gmail.com> wrote:
>
>
>
> 2014-10-17 15:49 GMT+02:00 Max Leske <maxleske(a)gmail.com <mailto:maxleske@gmail.com>>:
>
>> On 17.10.2014, at 15:25, Eliot Miranda <eliot.miranda(a)gmail.com <mailto:eliot.miranda@gmail.com>> wrote:
>>
>> Hi Max,
>>
>> On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com <mailto:maxleske@gmail.com>> wrote:
>>
>>>
>>>> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com <mailto:btc@openInWorld.com>> wrote:
>>>>
>>>> Richard Sargent wrote:
>>>>> Eliot Miranda-2 wrote
>>>>>> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>>>>>> richard.sargent@
>>>>>>> wrote:
>>>>>>> One of the best things about Smalltalk is how easily we can say what we
>>>>>>> mean. I think you would be better off creating a method named something
>>>>>>> like
>>>>>>> #hasSameEffectAs: to answer what you are presently using #= to do, and
>>>>>>> change #= to answer the, in my opinion, more sensible "is the same as"
>>>>>>> that
>>>>>>> we conventionally think of #= meaning.
>>>>>>>
>>>>>> But that's the point. #= has to mean something and having it mean #==
>>>>>> isn't useful, so one has to choose some value-based semantic for
>>>>>> CompiledMethod>>#= and the one that's there is useful. Defining what #=
>>>>>> means for some value type is far easier than defining what it might mean
>>>>>> for something as complex as a CompiledMethod. The definition in
>>>>>> Squeak/Pharo has been useful to me in implementing a closure-based system,
>>>>>> so I'm unapologetic about the current definition. It is a good one but it
>>>>>> doesn't preclude defining others.
>>>>> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
>>>>> provides greater clarity and add an argument against something I didn't say.
>>>>> I also don't think defining equality for a CompiledMethod is particularly
>>>>> difficult. If I were to recompile a method's source code, I would get a new
>>>>> instance of a CompiledMethod that would, in my opinion, be equal to the one
>>>>> already installed in the class (and perhaps cached in the VM's
>>>>> optimizations). So one would be able to say that we would not replace an
>>>>> existing CompiledMethod with an equal one. The current implementation of #=
>>>>> has no such characteristic, since it proclaims a CompiledMethod named #a to
>>>>> be equal to one named #z.
>>>>
>>>> @Richard
>>>>
>>>> That doesn't seem to be a good example for what your trying to say.
>>>> Given...
>>>>
>>>> [1] SomeClass>>a "original instance"
>>>> ^1
>>>>
>>>> [2] SomeClass>>a "recompiled instance"
>>>> ^1
>>>>
>>>> [3] SomeClass>>z
>>>> ^1
>>>>
>>>> ...you seem to be saying that its useful to know if [1]=[2],
>>>> but imply that is invalidated by [2]=[3] ?
>>>>
>>>> But [1]=[2] remains true, and just as useful for your example.
>>>>
>>>>
>>>> @Max
>>>>
>>>> I guess to call it a bug, you bumped into a different use case
>>>> where [2]=[3] is problematic. Can you describe that?
>>>
>>> Well, not problematic. Once you accept that neither selector nor class are part of a CompiledMethod it is obvious that two instances with the same byte codes produce the same hash.
>>>
>>> The actual problem is more one of understanding and use. The following code answers a collection with the CompiledMethods Collection>>add:, Collection>>do: and Collection>>remove:ifAbsent:
>>>
>>> Collection methods select: #isAbstract.
>>>
>>> All three CompiledMethods are implemented as â^ self subclassResponsibilityâ, so they have the same byte codes. Now, if you take that collection and make a set out of it youâll lose Collection>>do: since #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because the number of arguments is calculated into the hash (actually the CompiledMethod header is).
>>
>> Surely the issue is that "aClass methods" should answer an IdentitySet right?
>
> Well, in the case of my example that wouldnât change anything. As soon as you put the methods into a set youâll end up with less entries than before again. Selectors are unique per class anyway so I donât quite see the benefit of using an IdentitySet over an OrderedCollection (or a Bag for that matter), except for making it more obvious that the result of the message #methods doesnât need to be filtered further.
>
> I should add that the code, the student who discovered the clash wrote, looked more like this:
>
> result := Set new.
> Collection methods do: [ :m |
> m isAbstract ifTrue: [ result add: m ] ].
>
> Max
>
>
> Why not just keep a dictionary, like methodDictionary select: #isAbstract or something like thatâ¦
Youâre right of course, thereâs no need to put methods into a set. The code is from an exercise and the students arenât used to Smalltalk, so they end up with all sorts of code.
>
>>
>>
>>> So, as long as you think of CompiledMethods as objects that have a name, it looks like a bug and in my opinion this behaviour is something that messes with the mind of newcomers. Just a (silly) idea: something like a CompiledMethodWrapper might solve the problem (at least from the user perspective; everything is slightly different from the VM perspective :) ), as it could hold on to the class and the selector independently of the actual CompiledMethod.
>>>
>>> In the end however, one doesnât work with compiled methods a lot and the hash situation is unlikely to cause a lot of problems (people working with CompiledMethod usually know what they are doing).
>>>
>>> Cheers,
>>> Max
>>>
>>>>
>>>>
>>>> cheers -ben
>>>>
>>>>
>>>>> The blue book say #= means "Answer whether the receiver and the argument
>>>>> represent the same component." The current implementation does so only for
>>>>> some, in my opinion, counter-intuitive definition of "same component".
>>>>> --
>>>>> View this message in context: http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478… <http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…>
>>>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com <http://nabble.com/>.
>>
>> Eliot (phone)
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Nicolas Cellier
2014-10-17 15:49 GMT+02:00 Max Leske <maxleske(a)gmail.com>:
>
> On 17.10.2014, at 15:25, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi Max,
>
> On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com> wrote:
>
>
> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com> wrote:
>
> Richard Sargent wrote:
>
> Eliot Miranda-2 wrote
>
> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>
> richard.sargent@
>
> wrote:
> One of the best things about Smalltalk is how easily we can say what we
> mean. I think you would be better off creating a method named something
> like
> #hasSameEffectAs: to answer what you are presently using #= to do, and
> change #= to answer the, in my opinion, more sensible "is the same as"
> that
> we conventionally think of #= meaning.
>
> But that's the point. #= has to mean something and having it mean #==
> isn't useful, so one has to choose some value-based semantic for
> CompiledMethod>>#= and the one that's there is useful. Defining what #=
> means for some value type is far easier than defining what it might mean
> for something as complex as a CompiledMethod. The definition in
> Squeak/Pharo has been useful to me in implementing a closure-based system,
> so I'm unapologetic about the current definition. It is a good one but it
> doesn't preclude defining others.
>
> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
> provides greater clarity and add an argument against something I didn't
> say.
> I also don't think defining equality for a CompiledMethod is particularly
> difficult. If I were to recompile a method's source code, I would get a new
> instance of a CompiledMethod that would, in my opinion, be equal to the one
> already installed in the class (and perhaps cached in the VM's
> optimizations). So one would be able to say that we would not replace an
> existing CompiledMethod with an equal one. The current implementation of #=
> has no such characteristic, since it proclaims a CompiledMethod named #a to
> be equal to one named #z.
>
>
> @Richard
>
> That doesn't seem to be a good example for what your trying to say.
> Given...
>
> [1] SomeClass>>a "original instance"
> ^1
>
> [2] SomeClass>>a "recompiled instance"
> ^1
>
> [3] SomeClass>>z
> ^1
>
> ...you seem to be saying that its useful to know if [1]=[2],
> but imply that is invalidated by [2]=[3] ?
>
> But [1]=[2] remains true, and just as useful for your example.
>
>
> @Max
>
> I guess to call it a bug, you bumped into a different use case
> where [2]=[3] is problematic. Can you describe that?
>
>
> Well, not problematic. Once you accept that neither selector nor class are
> part of a CompiledMethod it is obvious that two instances with the same
> byte codes produce the same hash.
>
> The actual problem is more one of understanding and use. The following
> code answers a collection with the CompiledMethods Collection>>add:,
> Collection>>do: and Collection>>remove:ifAbsent:
>
> Collection methods select: #isAbstract.
>
>
> All three CompiledMethods are implemented as â^ self
> subclassResponsibilityâ, so they have the same byte codes. Now, if you take
> that collection and make a set out of it youâll lose Collection>>do: since
> #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because
> the number of arguments is calculated into the hash (actually the
> CompiledMethod header is).
>
>
> Surely the issue is that "aClass methods" should answer an IdentitySet
> right?
>
>
> Well, in the case of my example that wouldnât change anything. As soon as
> you put the methods into a set youâll end up with less entries than before
> again. Selectors are unique per class anyway so I donât quite see the
> benefit of using an IdentitySet over an OrderedCollection (or a Bag for
> that matter), except for making it more obvious that the result of the
> message #methods doesnât need to be filtered further.
>
> I should add that the code, the student who discovered the clash wrote,
> looked more like this:
>
> result := Set new.
> Collection methods do: [ :m |
> m isAbstract ifTrue: [ result add: m ] ].
>
> Max
>
>
Why not just keep a dictionary, like methodDictionary select: #isAbstract
or something like that...
>
>
> So, as long as you think of CompiledMethods as objects that have a name,
> it looks like a bug and in my opinion this behaviour is something that
> messes with the mind of newcomers. Just a (silly) idea: something like a
> CompiledMethodWrapper might solve the problem (at least from the user
> perspective; everything is slightly different from the VM perspective :) ),
> as it could hold on to the class and the selector independently of the
> actual CompiledMethod.
>
> In the end however, one doesnât work with compiled methods a lot and the
> hash situation is unlikely to cause a lot of problems (people working with
> CompiledMethod usually know what they are doing).
>
> Cheers,
> Max
>
>
>
> cheers -ben
>
>
> The blue book say #= means "Answer whether the receiver and the argument
> represent the same component." The current implementation does so only for
> some, in my opinion, counter-intuitive definition of "same component".
> --
> View this message in context:
> http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…
> Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com <http://nabble.com/>.
>
>
> Eliot (phone)
>
>
>
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Max Leske
> On 17.10.2014, at 15:25, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi Max,
>
> On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com <mailto:maxleske@gmail.com>> wrote:
>
>>
>>> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com <mailto:btc@openInWorld.com>> wrote:
>>>
>>> Richard Sargent wrote:
>>>> Eliot Miranda-2 wrote
>>>>> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>>>>> richard.sargent@
>>>>>> wrote:
>>>>>> One of the best things about Smalltalk is how easily we can say what we
>>>>>> mean. I think you would be better off creating a method named something
>>>>>> like
>>>>>> #hasSameEffectAs: to answer what you are presently using #= to do, and
>>>>>> change #= to answer the, in my opinion, more sensible "is the same as"
>>>>>> that
>>>>>> we conventionally think of #= meaning.
>>>>>>
>>>>> But that's the point. #= has to mean something and having it mean #==
>>>>> isn't useful, so one has to choose some value-based semantic for
>>>>> CompiledMethod>>#= and the one that's there is useful. Defining what #=
>>>>> means for some value type is far easier than defining what it might mean
>>>>> for something as complex as a CompiledMethod. The definition in
>>>>> Squeak/Pharo has been useful to me in implementing a closure-based system,
>>>>> so I'm unapologetic about the current definition. It is a good one but it
>>>>> doesn't preclude defining others.
>>>> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
>>>> provides greater clarity and add an argument against something I didn't say.
>>>> I also don't think defining equality for a CompiledMethod is particularly
>>>> difficult. If I were to recompile a method's source code, I would get a new
>>>> instance of a CompiledMethod that would, in my opinion, be equal to the one
>>>> already installed in the class (and perhaps cached in the VM's
>>>> optimizations). So one would be able to say that we would not replace an
>>>> existing CompiledMethod with an equal one. The current implementation of #=
>>>> has no such characteristic, since it proclaims a CompiledMethod named #a to
>>>> be equal to one named #z.
>>>
>>> @Richard
>>>
>>> That doesn't seem to be a good example for what your trying to say.
>>> Given...
>>>
>>> [1] SomeClass>>a "original instance"
>>> ^1
>>>
>>> [2] SomeClass>>a "recompiled instance"
>>> ^1
>>>
>>> [3] SomeClass>>z
>>> ^1
>>>
>>> ...you seem to be saying that its useful to know if [1]=[2],
>>> but imply that is invalidated by [2]=[3] ?
>>>
>>> But [1]=[2] remains true, and just as useful for your example.
>>>
>>>
>>> @Max
>>>
>>> I guess to call it a bug, you bumped into a different use case
>>> where [2]=[3] is problematic. Can you describe that?
>>
>> Well, not problematic. Once you accept that neither selector nor class are part of a CompiledMethod it is obvious that two instances with the same byte codes produce the same hash.
>>
>> The actual problem is more one of understanding and use. The following code answers a collection with the CompiledMethods Collection>>add:, Collection>>do: and Collection>>remove:ifAbsent:
>>
>> Collection methods select: #isAbstract.
>>
>> All three CompiledMethods are implemented as â^ self subclassResponsibilityâ, so they have the same byte codes. Now, if you take that collection and make a set out of it youâll lose Collection>>do: since #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because the number of arguments is calculated into the hash (actually the CompiledMethod header is).
>
> Surely the issue is that "aClass methods" should answer an IdentitySet right?
Well, in the case of my example that wouldnât change anything. As soon as you put the methods into a set youâll end up with less entries than before again. Selectors are unique per class anyway so I donât quite see the benefit of using an IdentitySet over an OrderedCollection (or a Bag for that matter), except for making it more obvious that the result of the message #methods doesnât need to be filtered further.
I should add that the code, the student who discovered the clash wrote, looked more like this:
result := Set new.
Collection methods do: [ :m |
m isAbstract ifTrue: [ result add: m ] ].
Max
>
>
>> So, as long as you think of CompiledMethods as objects that have a name, it looks like a bug and in my opinion this behaviour is something that messes with the mind of newcomers. Just a (silly) idea: something like a CompiledMethodWrapper might solve the problem (at least from the user perspective; everything is slightly different from the VM perspective :) ), as it could hold on to the class and the selector independently of the actual CompiledMethod.
>>
>> In the end however, one doesnât work with compiled methods a lot and the hash situation is unlikely to cause a lot of problems (people working with CompiledMethod usually know what they are doing).
>>
>> Cheers,
>> Max
>>
>>>
>>>
>>> cheers -ben
>>>
>>>
>>>> The blue book say #= means "Answer whether the receiver and the argument
>>>> represent the same component." The current implementation does so only for
>>>> some, in my opinion, counter-intuitive definition of "same component".
>>>> --
>>>> View this message in context: http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478… <http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…>
>>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com <http://nabble.com/>.
>
> Eliot (phone)
Oct. 17, 2014
Re: [Pharo-dev] CompiledMethod>>hash can produce clashes
by Eliot Miranda
Hi Max,
On Oct 17, 2014, at 12:34 AM, Max Leske <maxleske(a)gmail.com> wrote:
>
>> On 17.10.2014, at 02:46, Ben Coman <btc(a)openInWorld.com> wrote:
>>
>> Richard Sargent wrote:
>>> Eliot Miranda-2 wrote
>>>> On Wed, Oct 15, 2014 at 10:50 AM, Richard Sargent <
>>>> richard.sargent@
>>>>> wrote:
>>>>> One of the best things about Smalltalk is how easily we can say what we
>>>>> mean. I think you would be better off creating a method named something
>>>>> like
>>>>> #hasSameEffectAs: to answer what you are presently using #= to do, and
>>>>> change #= to answer the, in my opinion, more sensible "is the same as"
>>>>> that
>>>>> we conventionally think of #= meaning.
>>>> But that's the point. #= has to mean something and having it mean #==
>>>> isn't useful, so one has to choose some value-based semantic for
>>>> CompiledMethod>>#= and the one that's there is useful. Defining what #=
>>>> means for some value type is far easier than defining what it might mean
>>>> for something as complex as a CompiledMethod. The definition in
>>>> Squeak/Pharo has been useful to me in implementing a closure-based system,
>>>> so I'm unapologetic about the current definition. It is a good one but it
>>>> doesn't preclude defining others.
>>> An interesting response. You ignored the point that e.g. #hasSameEffectAs:
>>> provides greater clarity and add an argument against something I didn't say.
>>> I also don't think defining equality for a CompiledMethod is particularly
>>> difficult. If I were to recompile a method's source code, I would get a new
>>> instance of a CompiledMethod that would, in my opinion, be equal to the one
>>> already installed in the class (and perhaps cached in the VM's
>>> optimizations). So one would be able to say that we would not replace an
>>> existing CompiledMethod with an equal one. The current implementation of #=
>>> has no such characteristic, since it proclaims a CompiledMethod named #a to
>>> be equal to one named #z.
>>
>> @Richard
>>
>> That doesn't seem to be a good example for what your trying to say.
>> Given...
>>
>> [1] SomeClass>>a "original instance"
>> ^1
>>
>> [2] SomeClass>>a "recompiled instance"
>> ^1
>>
>> [3] SomeClass>>z
>> ^1
>>
>> ...you seem to be saying that its useful to know if [1]=[2],
>> but imply that is invalidated by [2]=[3] ?
>>
>> But [1]=[2] remains true, and just as useful for your example.
>>
>>
>> @Max
>>
>> I guess to call it a bug, you bumped into a different use case
>> where [2]=[3] is problematic. Can you describe that?
>
> Well, not problematic. Once you accept that neither selector nor class are part of a CompiledMethod it is obvious that two instances with the same byte codes produce the same hash.
>
> The actual problem is more one of understanding and use. The following code answers a collection with the CompiledMethods Collection>>add:, Collection>>do: and Collection>>remove:ifAbsent:
>
> Collection methods select: #isAbstract.
>
> All three CompiledMethods are implemented as â^ self subclassResponsibilityâ, so they have the same byte codes. Now, if you take that collection and make a set out of it youâll lose Collection>>do: since #do: and #add: produce the same hash, but #remove:ifAbsent: doesnât because the number of arguments is calculated into the hash (actually the CompiledMethod header is).
Surely the issue is that "aClass methods" should answer an IdentitySet right?
> So, as long as you think of CompiledMethods as objects that have a name, it looks like a bug and in my opinion this behaviour is something that messes with the mind of newcomers. Just a (silly) idea: something like a CompiledMethodWrapper might solve the problem (at least from the user perspective; everything is slightly different from the VM perspective :) ), as it could hold on to the class and the selector independently of the actual CompiledMethod.
>
> In the end however, one doesnât work with compiled methods a lot and the hash situation is unlikely to cause a lot of problems (people working with CompiledMethod usually know what they are doing).
>
> Cheers,
> Max
>
>>
>>
>> cheers -ben
>>
>>
>>> The blue book say #= means "Answer whether the receiver and the argument
>>> represent the same component." The current implementation does so only for
>>> some, in my opinion, counter-intuitive definition of "same component".
>>> --
>>> View this message in context: http://forum.world.st/CompiledMethod-hash-can-produce-clashes-tp4784722p478…
>>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Eliot (phone)
Oct. 17, 2014