On Fri, Jan 27, 2017 at 9:11 PM, stepharong <stepharong@free.fr> wrote:
I should tell you that I do not like it at all. Hey students inside comments self means the class and outside the instance! WTF?
Which behaviour do you no like, Stef? The current or the one we are discussing?
I think that we should have another kind of pseudo variable but not self.
Also an option and more explicit than `self `working, but meaning something else than at run-time. In the case where `self` is the current object (as in the debugger) the code can be executed with DO like when it is later run. That is what I would find useful for prototyping. -- Siemen
Hi all,
in Nautilus, `self` is always the current class instance. This is great for coding class side methods because we can test code fragments live in the editor, but for instance side methods I have not seen the usefulness of it. At times it can even be confusing and cause errors since a "print it" of it looks quite like an instance (`a Listener` vs `Listener`).
Is there a rationale why `self` in instance view does not raise an error or is nil? And, more importantly, could there be a way to set it to a specific value (= can we browse a class with self bound to an specific instance).
In Pharo 6 if you tag a class method with
<sampleInstance> ... ^ return the instance
then you get automatically an icon to get an inspector on the instance. From there you can do whatever you want.
This would resemble programming in the debugger, but provide the overview that a class browser provides.
cheers, Siemen
-- Using Opera's mail client: http://www.opera.com/mail/