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). This would resemble programming in the debugger, but provide the overview that a class browser provides. cheers, Siemen
Hi,
On Jan 27, 2017, at 9:59 AM, Siemen Baader <siemenbaader@gmail.com> wrote:
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?
That is because you can write: self new and work with an instance.
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). This would resemble programming in the debugger, but provide the overview that a class browser provides.
You can do that to some extent in the Meta tab of the inspector. Cheers, Doru
cheers, Siemen
-- www.tudorgirba.com www.feenk.com "We cannot reach the flow of things unless we let go."
Hi Tudor, On Fri, Jan 27, 2017 at 10:23 AM, Tudor Girba <tudor@tudorgirba.com> wrote:
Is there a rationale why `self` in instance view does not raise an error
or is nil?
That is because you can write: self new and work with an instance.
ok.
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). This would resemble programming in the debugger, but provide the overview that a class browser provides.
You can do that to some extent in the Meta tab of the inspector.
The inspector. Another great place to write code. I should use it more for that also - thanks! -- Siemen
Hi Tudor. 2017-01-27 10:23 GMT+01:00 Tudor Girba <tudor@tudorgirba.com>:
Is there a rationale why `self` in instance view does not raise an error or is nil?
That is because you can write: self new and work with an instance.
I expect from you some exciting ideas in this direction. :) Because your examples framework provide many interesting possibility to work always in context of some live instance. In browser we can add some pluggability to specify what instance use for playing in context of selected class or method. By default it could be just "self new". It will gives many interesting options: - when "examplar" method is selected "self" will point to describing instance. - when browser is opened from debugger or inspector "self" will point to current object from these tools. - type hints. No type inference - just live information - LightTable features. When method is selected, it executed in background and browser collects and show live data: temp types, values, execution could, dead code, also visualization if possible. So it could add many power to our environment.
Hi, On Fri, Jan 27, 2017 at 4:09 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi Tudor.
2017-01-27 10:23 GMT+01:00 Tudor Girba <tudor@tudorgirba.com>:
Is there a rationale why `self` in instance view does not raise an error or is nil?
That is because you can write: self new and work with an instance.
I expect from you some exciting ideas in this direction. :) Because your examples framework provide many interesting possibility to work always in context of some live instance.
In browser we can add some pluggability to specify what instance use for playing in context of selected class or method. By default it could be just "self new".
Yes, I had ideas along these lines as well. There could be a field above the code panel that defines self as self new, which could be changed accordingly..
It will gives many interesting options: - when "examplar" method is selected "self" will point to describing instance. - when browser is opened from debugger or inspector "self" will point to current object from these tools. - type hints. No type inference - just live information - LightTable features. When method is selected, it executed in background and browser collects and show live data: temp types, values, execution could, dead code, also visualization if possible.
So it could add many power to our environment.
-- Siemen
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? I think that we should have another kind of pseudo variable but not self.
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/
On Sat, Jan 28, 2017 at 4:11 AM, 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?
I think that we should have another kind of pseudo variable but not self.
So in comments on the instance-side should we have pseudo variable "class" or "myclass" ? But then do students try to use that in the playground? Maybe instance-side comments should have no pseudo variable, and use the class directly. After all, comments have an absolute position in the hierarchy. Its not like you can evaluate the comment from a subclass. On class-side "self" seems okay in comments, since it means the same thing as in code. Perhaps it even draws attention of students that the class is itself an object. cheers -ben
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/
Yes. This trick is handy but totally confusing. I think that self in playground should return nil. because self only makes sense in method body and inspector pane. Stef On Sat, Jan 28, 2017 at 4:50 AM, Ben Coman <btc@openinworld.com> wrote:
On Sat, Jan 28, 2017 at 4:11 AM, 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?
I think that we should have another kind of pseudo variable but not self.
So in comments on the instance-side should we have pseudo variable "class" or "myclass" ? But then do students try to use that in the playground?
Maybe instance-side comments should have no pseudo variable, and use the class directly. After all, comments have an absolute position in the hierarchy. Its not like you can evaluate the comment from a subclass.
On class-side "self" seems okay in comments, since it means the same thing as in code. Perhaps it even draws attention of students that the class is itself an object.
cheers -ben
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/
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/
On Tue, 31 Jan 2017 16:02:38 +0100, Siemen Baader <siemenbaader@gmail.com> wrote:
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 do not like the current one even if I remember that I push its usage.
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/
-- Using Opera's mail client: http://www.opera.com/mail/
participants (6)
-
Ben Coman -
Denis Kudriashov -
Siemen Baader -
Stephane Ducasse -
stepharong -
Tudor Girba