[Newbies] Re: anObject select: #aMethodName -- is this good Squeak?

2007-02-08 Thread Klaus D. Witzel

On Thu, 08 Feb 2007 10:21:53 +0100, Giovanni Corriga wrote:


Il giorno gio, 08/02/2007 alle 07.53 +0100, Lukas Renggli ha scritto:

 That was one of the things that I originally thought would weigh
 against this idiom, but found to my surprise that Senders of
 identified these references correctly-- I'd previously found symbols
 being included in my results and wondered why, but it looks as though
 someone was aware of this gotcha.

Yes, browsing senders also works. Squeak puts all the data needed by a
compiled method into a special place called literal array. So all
selectors you send (expect special ones like #ifTrue:, #ifFalse:,
#and:, #or, #whileTrue, ...) are in there, all symbols you use, all
classes you reference, all strings and numbers. If you browse for
senders, the system just looks at this literal array and doesn't make
the difference if this is just a symbol or an actual selector of a
message send.


Does it? I tried browsing for senders on a 3.9 image before sending my
message, and it didn't work.


What was that symbol (for reproduction)?

FWIW in #thoroughWhichSelectorsReferTo:special:byte: it is sought for  
#allButLast of the method's literals. This can be a problem if the method  
wasn't (re-)created after the image was traitified.


Also, SystemNavigation#allCallsOn: is influenced by (Preferences  
thoroughSenders).


/Klaus


Giovanni



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: anObject select: #aMethodName -- is this good Squeak?

2007-02-08 Thread Giovanni Corriga
Il giorno gio, 08/02/2007 alle 11.37 +0100, Klaus D. Witzel ha scritto:
 On Thu, 08 Feb 2007 10:21:53 +0100, Giovanni Corriga wrote:

  Does it? I tried browsing for senders on a 3.9 image before sending my
  message, and it didn't work.
 
 What was that symbol (for reproduction)?
 
 FWIW in #thoroughWhichSelectorsReferTo:special:byte: it is sought for  
 #allButLast of the method's literals. This can be a problem if the method  
 wasn't (re-)created after the image was traitified.
 
 Also, SystemNavigation#allCallsOn: is influenced by (Preferences  
 thoroughSenders).

Ok, looking for senders from the Method Finder and/or the Message Finder
works. But clicking on the Senders button on the browser doesn't show
the symbol with the other selectors.

I tested this by creating a bogus class and adding a method with this:

#(1 2 3) select: #even.

thoroughSenders is set.

Giovanni

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: anObject select: #aMethodName -- is this good Squeak?

2007-02-08 Thread Klaus D. Witzel

On Thu, 08 Feb 2007 12:15:34 +0100, Giovanni Corriga wrote:

Il giorno gio, 08/02/2007 alle 11.37 +0100, Klaus D. Witzel ha scritto:

On Thu, 08 Feb 2007 10:21:53 +0100, Giovanni Corriga wrote:



 Does it? I tried browsing for senders on a 3.9 image before sending my
 message, and it didn't work.

What was that symbol (for reproduction)?

FWIW in #thoroughWhichSelectorsReferTo:special:byte: it is sought for
#allButLast of the method's literals. This can be a problem if the  
method

wasn't (re-)created after the image was traitified.

Also, SystemNavigation#allCallsOn: is influenced by (Preferences
thoroughSenders).


Ok, looking for senders from the Method Finder and/or the Message Finder
works. But clicking on the Senders button on the browser doesn't show
the symbol with the other selectors.

I tested this by creating a bogus class and adding a method with this:

#(1 2 3) select: #even.

thoroughSenders is set.


I tested: in IntegerTest#testEven I added a line at the end
.
self assert: (1 perform: #odd)

Now senders of #odd, when selecting 'odd' and doing alt-n, includes the  
changed method.


But the browser's senders button apparently is not in sync with the much  
better capabilities of #allCallsOn: and #thoroughSenders. I must say that  
this was the first time ever that I used this particular button ;-)


/Klaus


Giovanni



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Re: A do with ONLY index? (plus,. a style question)

2007-02-08 Thread Blake
On Sun, 04 Feb 2007 02:16:09 -0800, Klaus D. Witzel  
[EMAIL PROTECTED] wrote:



You might want to compare:

class sidenew
| instance |
instance := self new.
instance thisAndThat extra code needed.
^ instance

instance sideinitialize
sent automatically by Behaviornew
iVar1 := 'text'.
iVar2 := 0

The latter is preferable over the former (less code, less maintenance).  
But often people put utility methods like #on:, #with: etc on the class  
side, for non-trivial initializations.


When you say sent automatically by Behaviornew is that true? In other  
words:


x := abitraryObject new.

results in an attempt to call arbitraryObjectinitialize?

 From the (re-)usability point of view, if you had getters/setters (like  
in traits), the perfect approach is

x := MyClass new setY: 'text';
setZ: 0;
yourself.

Or, like I prefer to do it
(x := MyClass new)
setY: 'text';
setZ: 0.


I suppose we don't worry much about the waste of, say, setting up some  
features with default values and then having to discard those when the  
user sets them to something actually useful?


===Blake===
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners