Hi
I would like to find the person who did the following:
you can select a comment and evaluate it. In VW and Squeak now you can write "self ..." in the comment and in such a case it refers to the ***class***
I was so used to this browser trick that I never realized how it could be dangerous for newbie. Imagine self in comment and in the code represent different object: instance and its class. So I would like to know if we could change or introduce another browser trick class selfClass
this way we could have
"selfClass new xxx" and not "self new xxx"
Is the author of the previous trick around? What the other are thinking about that?
Stef
Dr. Stéphane DUCASSE (ducasse@iam.unibe.ch) http://www.iam.unibe.ch/~ducasse/ "if you knew today was your last day on earth, what would you do different? ... especially if, by doing something different, today might not be your last day on earth" Calvin&Hobbes
On Sunday 01 December 2002 02:29 am, Stephane Ducasse wrote:
I would like to find the person who did the following:
you can select a comment and evaluate it. In VW and Squeak now you can write "self ..." in the comment and in such a case it refers to the ***class***
I was so used to this browser trick that I never realized how it could be dangerous for newbie. Imagine self in comment and in the code represent different object: instance and its class.
Which object instance? You don't have a specific one if you're working with code.
So I would like to know if we could change or introduce another browser trick class selfClass
this way we could have
"selfClass new xxx"
and not
"self new xxx"
Do you mean you want to get rid of "self" in that context?
Is the author of the previous trick around?
Looks like it's Dan Ingalls, from early code:
di 5/10/1998 21:38 do-its 4 implementors in no change set
ParagraphEditor>>doIt "Set the context to include pool vars of the model. Then evaluate." ^ self evaluateSelection.
Though on ParagraphEditor>>evaluateSelection we see Bob Arning's initials:
RAA 2/5/2001 10:43 do-its 1 implementor in no change set
Looking at this, we see that it's possible for the browser model itself to specify the context for the evaluation:
Browser>>doItReceiver "This class's classPool has been jimmied to be the classPool of the class being browsed. A doIt in the code pane will let the user see the value of the class variables."
^ self selectedClass ifNil: [FakeClassPool new]
So the attached is a simple hack that does just this. Maybe I'm missing something important here.
This is a browser in which doIt, printIt, etc. contexts are made safe with respect to "self". Evaluating "selfClass" will give you the class being browsed.
try: SafetyBrowser fullOnClass: SafetyBrowser
Note that the class pools and shared pools are NOT copies, so changes to them can affect the original class. This is due to the use of FakeClassPool all over the place (though FakeClassPool could be changed to use copies, of course, or could be made like SafeFakeClassPool is here to make these changes throughout the environment).
Hi ned
What I just want is to change self in a comment by selfClass or class. I think that this is not dan that did what I'm looking for. I remember a person posting a VW like behavior for comment interpretation.
I was so used to this browser trick that I never realized how it could be dangerous for newbie. Imagine self in comment and in the code represent different object: instance and its class.
Which object instance? You don't have a specific one if you're working with code.
Exactly that's why self should not represent the class in the comment. But we should use a different keyword.
So I would like to know if we could change or introduce another browser trick class selfClass
this way we could have
"selfClass new xxx"
and not
"self new xxx"
Do you mean you want to get rid of "self" in that context?
in method comment's yes
I want
myMethod "selfClass new mymethod"
self doSomething
and not
myMethod "self new my method" self doSomething
Is the author of the previous trick around?
Looks like it's Dan Ingalls, from early code:
di 5/10/1998 21:38 ‚ do-its ‚ 4 implementors ‚ in no change set ‚
ParagraphEditor>>doIt "Set the context to include pool vars of the model. Then evaluate." ^ self evaluateSelection.
Though on ParagraphEditor>>evaluateSelection we see Bob Arning's initials:
RAA 2/5/2001 10:43 ‚ do-its ‚ 1 implementor ‚ in no change set ‚
Looking at this, we see that it's possible for the browser model itself to specify the context for the evaluation:
Browser>>doItReceiver "This class's classPool has been jimmied to be the classPool of the class being browsed. A doIt in the code pane will let the user see the value of the class variables."
^ self selectedClass ifNil: [FakeClassPool new]
So the attached is a simple hack that does just this. Maybe I'm missing something important here.
This is a browser in which doIt, printIt, etc. contexts are made safe with respect to "self". Evaluating "selfClass" will give you the class being browsed.
try: SafetyBrowser fullOnClass: SafetyBrowser
Note that the class pools and shared pools are NOT copies, so changes to them can affect the original class. This is due to the use of FakeClassPool all over the place (though FakeClassPool could be changed to use copies, of course, or could be made like SafeFakeClassPool is here to make these changes throughout the environment).
-- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE <SafetyBrowser-nk.1.cs>
Dr. Stéphane DUCASSE (ducasse@iam.unibe.ch) http://www.iam.unibe.ch/~ducasse/ "if you knew today was your last day on earth, what would you do different? ... especially if, by doing something different, today might not be your last day on earth" Calvin&Hobbes
On Sunday 01 December 2002 08:33 am, Stephane Ducasse wrote:
in method comment's yes
I want
myMethod "selfClass new mymethod"
self doSomething
and not
myMethod "self new my method"
self doSomething
So doesn't the change set I posted do that (at least in SafetyBrowsers; it's just a proof of concept)?
squeak-dev@lists.squeakfoundation.org