Re: [Pharo-users] PharoCommonTools methods
On 25 May 2015, at 18:27, Matthieu Lacaton matthieu.laca...@gmail.com wrote: Hello everyone, It's probably a silly question but there is something I don't understand in the PharoCommonTools class. There are many methods in this class that i can't find in the image. For example, PharoCommonTools workspaceTool refers to self workspace but I can't find any method named workspace in this class or its super classes. And it is the same for all the other tools. What am I missing ? :s The class PharoCommonTools inherits from ToolRegistry (in other words, ToolRegistry is the parent of PharoCommonTools), which means that all methods from the parent are available in the child as well, as if they were defined there. This is a fundamental concept behind the implementation of Pharo (inheritance, method lookup). Thanks, Matthieu
Re: [Pharo-users] PharoCommonTools methods
2015-05-25 18:27 GMT+02:00 Matthieu Lacaton matthieu.laca...@gmail.com: Hello everyone, It's probably a silly question but there is something I don't understand in the PharoCommonTools class. There are many methods in this class that i can't find in the image. For example, *PharoCommonTools workspaceTool* refers to *self workspace* but I can't find any method named workspace in this class or its super classes. And it is the same for all the other tools. What am I missing ? :s The super class ToolRegistry has a special implementation for method doesNotUnderstand: If it can not understand a message, it looks in its tools registry for a registered tool under that name. Workspace for example registers itself for the key workspace and Nautilus for browser (Smalltalk tools instVarNamed:#tools ) at:#browser Nautilus Thanks, Matthieu
Re: [Pharo-users] PharoCommonTools methods
Oh yes thx Nicolai, I did not look in the #doesNotUnderstand method. What is the main purpose of doing this instead of actually implementing a method ? 2015-05-25 19:20 GMT+02:00 Nicolai Hess nicolaih...@web.de: 2015-05-25 18:27 GMT+02:00 Matthieu Lacaton matthieu.laca...@gmail.com: Hello everyone, It's probably a silly question but there is something I don't understand in the PharoCommonTools class. There are many methods in this class that i can't find in the image. For example, *PharoCommonTools workspaceTool* refers to *self workspace* but I can't find any method named workspace in this class or its super classes. And it is the same for all the other tools. What am I missing ? :s The super class ToolRegistry has a special implementation for method doesNotUnderstand: If it can not understand a message, it looks in its tools registry for a registered tool under that name. Workspace for example registers itself for the key workspace and Nautilus for browser (Smalltalk tools instVarNamed:#tools ) at:#browser Nautilus Thanks, Matthieu
Re: [Pharo-users] PharoCommonTools methods
On 25 May 2015 at 19:34, Matthieu Lacaton matthieu.laca...@gmail.com wrote: What is the main purpose of doing this instead of actually implementing a method ? Being lazy: #doesNotUnderstand is implemented only once, independent of the number of different tools that will be added in the future.