[Newbies] Tracing back objects

2007-05-25 Thread subbukk
Hi,

The following code:
 CompiledMethod allInstances inject: (CompiledMethod allInstances first) into: 
[:m :i | i size  m size ifTrue: [i] ifFalse: [m]].

gives the largest method as an object. Is there an efficient way to trace back 
the method selector and its class without doing a brute force lookup?

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


[Newbies] Re: Tracing back objects

2007-05-25 Thread Klaus D. Witzel

On Fri, 25 May 2007 12:18:38 +0200, subbukk wrote:


Hi,

The following code:
 CompiledMethod allInstances inject: (CompiledMethod allInstances first)  
into:

[:m :i | i size  m size ifTrue: [i] ifFalse: [m]].

gives the largest method as an object. Is there an efficient way to  
trace back

the method selector and its class without doing a brute force lookup?


On pre-traits images you'd need (aMethod who) but from 3.9 on #who is  
deprecated. If you're on 3.9 the comment in #who tells the fast way.


/Klaus


TIA .. Subbu



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


Re: [Newbies] undefinedobject showflag

2007-05-25 Thread mstram

Some further experimentation :

1)Add a morph to the world.

2) open a viewer, (with the viewersInFlaps option on)

3) Open the halo for that viewer
4) Drag the viewer to the world (off the flap)

5) Select the morph again, open it's halo, (try) to open a viewer for it
(with the other viewer still displayed) and the undefinedObjectShowFlap
error is displayed.

If the dragged/disconnected (from the flap) viewer is first deleted,  the
error message doesn't appear.

Mike
-- 
View this message in context: 
http://www.nabble.com/undefinedobject-showflag-tf3812973.html#a10801776
Sent from the Squeak - Beginners mailing list archive at Nabble.com.

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


Re: [Newbies] Tracing back objects

2007-05-25 Thread Bert Freudenberg


On May 25, 2007, at 12:18 , subbukk wrote:


Hi,

The following code:
 CompiledMethod allInstances inject: (CompiledMethod allInstances  
first) into:

[:m :i | i size  m size ifTrue: [i] ifFalse: [m]].

gives the largest method as an object.


Note that

CompiledMethod someInstance

is much more efficient than

CompiledMethod allInstances first


Is there an efficient way to trace back
the method selector and its class without doing a brute force lookup?


Not in 3.8, but I think later versions might cache the owner of CMs.  
Anyway, you might want to try this:


(CompiledMethod allInstances detectMax: [:m | m size]) who


- Bert -


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


Re: [Newbies] undefinedobject showflag

2007-05-25 Thread mstram

Further findings.

If I delete all open viewers / flaps, the error message also goes away when
saving the image !

Mike
-- 
View this message in context: 
http://www.nabble.com/undefinedobject-showflag-tf3812973.html#a10802839
Sent from the Squeak - Beginners mailing list archive at Nabble.com.

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


Re: [Newbies] Re: Tracing back objects

2007-05-25 Thread subbukk
On Friday 25 May 2007 5:02 pm, Klaus D. Witzel wrote:
 On pre-traits images you'd need (aMethod who) but from 3.9 on #who is
 deprecated. If you're on 3.9 the comment in #who tells the fast way.

Thanks. methodClass and selector worked. .. Subbu
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] which code browser to use?

2007-05-25 Thread Michael van der Gulik

Nick Ager wrote:


Hi,

What are the pros and cons of the different code browsers I see in my
image (it's based on Damien Cassou's squeak-web-95-2.zip). I see:

* Browser (appears to be the default)
* HierarchyBrowser
* OBSystemBrowser
* ShoutOmniBrowser
* eComspletionOmniBrowser
* Tric-RefactoringBrowser
* WhiskerBrowser
* OmniBrowser


It really depends on your preference. Try them; I've been Squeak for 
quite a few years and I've only really ever needed to use the standard 
Browser.


The Browser and HierarchyBrowser are standard tools in a standard image.

I don't know much about the OmniBrowser, but I think it's an intelligent 
re-design of the standard browser in that it looks the same but works 
much more intelligently under the covers. I think people use it as a 
starting point for developing experimental browsers.


Shout is a package that gives you syntax hilighting, so the 
ShoutOmniBrowser is Shout plus the OmniBrowser.


eCompletion is a package that gives you keyword completion (ala other 
IDEs)... ditto for eCompletionOmniBrowser.


The WhiskerBrowser has a completely different UI - some people swear by it.

The ones I haven't mentioned are the ones I don't know anything about.



I find myself switching between different browsers and not finding one
which provides a superset of browsing functionality.I feel must be
missing a trick. Is there a prefered browser amoungst more experienced
users?


Again, I just use the standard browser. Personally I'm dissatisfied with 
it because it's completely non-obvious as to how you're meant to use it 
- even after a few years, I still haven't worked out what the standard 
way of defining a new method is; usually I just cheat and modify an 
existing method with a new name.


You'll also find that a lot of the functionality you need is done in 
other places in the image. The biggest Aha! moment for me was 
discovering alt-n (find senders of...) and alt-m (find implementers 
or...) - select text and press those keys.




How do I register a prefered browser as the default for alt-b and
tools tab-browser?


I've just had a look in the image. This is what I did:

1. I vaguely recall being asked what Tool set I wanted to use at some 
stage, so I opened up my bog-standard browser :-) and tried to find any 
class with the word Tool in the name. I saw a class called ToolSet 
so I looked at that.


2. ToolSet has no instance methods, so I looked at the class methods.

3. This looks like it - there's a method called #browse:selector:, so I 
looked at that. That calls the method default which isn't there.


4. Looking for the implementation of default, I opened up a hierarchy 
browser on ToolSet and looked up the inheritance hiearchy. I found the 
implementation in AppRegistry. That calls self askForDefault.


5. I look at the implementation of askForDefault in the same class. At 
a brief glance, it has UI code in it, so I try calling it:


ToolSet askForDefault.

There you go.

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