Edit methods protocol by code
Hi, The code bellow should move all methods to a 'code' protocol. It works on some classes but not with all. In the later it results in a "no message" protocol. I can't find a reproductible case on the system classe, it may break in a class, then on a retry may not break on the same class. However applying twice the code bellow to the same class result in a no message protocol every time "Buggy" org := MyClass organization protocolOrganizer. org addProtocolNamed: 'code'. org allProtocols do: [:aProtocol | org moveMethodsFrom: aProtocol name to: 'code']. org removeEmptyProtocols. -- Dr. Geo http://drgeo.eu
When applyed to BenchmarkResult class it breaks, but not every time -- Dr. Geo http://drgeo.eu
Usual starting question, what version? cheers -ben On Fri, May 26, 2017 at 5:52 PM, Hilaire <hilaire@drgeo.eu> wrote:
When applyed to BenchmarkResult class it breaks, but not every time
-- Dr. Geo http://drgeo.eu
Pharo5, sorry. I used a different code to make it work: org := aClass organization protocolOrganizer. org addProtocolNamed: 'code'. org allMethods do: [:aMethod | org classify: aMethod inProtocolNamed: 'code']. org removeEmptyProtocols. Le 27/05/2017 à 03:37, Ben Coman a écrit :
Usual starting question, what version? cheers -ben
-- Dr. Geo http://drgeo.eu
2017-05-26 11:42 GMT+02:00 Hilaire <hilaire@drgeo.eu>:
"Buggy" org := MyClass organization protocolOrganizer. org addProtocolNamed: 'code'. org allProtocols do: [:aProtocol | org moveMethodsFrom: aProtocol name to: 'code']. org removeEmptyProtocols.
In Pharo 6 we introduced tags API: (MyClass methodsTaggedWith: #oldProtocol) do: [:each | each tagWith: #code]
participants (3)
-
Ben Coman -
Denis Kudriashov -
Hilaire