help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: [patch] Enhance to kernel/Behavior.st


From: Paolo Bonzini
Subject: [Help-smalltalk] Re: [patch] Enhance to kernel/Behavior.st
Date: Mon, 26 Oct 2009 17:48:31 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4

I'll answer to both messages in one.

3. superclasses Make the method set of Behavior more consistent and
predictable.

I don't like this very much and did not apply it.  Everything else is a
nice addition, but I'd be grateful if you move #printSuperclasses:using:
and #printSubclasses:using: into a "private" category since you're
touching this file.

This patch provides some extensions to Parser package of
packages/stinst/parser.

Extensions to Behavior: 1. lookupFormattedSourceString: aSelector

Lookup and return the formatted source codes of a method.

That should be #formattedSourceStringAt:, no? Also, it could be in kernel/Behavior.st since the #methodFormattedSourceString is present in kernel/CompildMeth.st (though disabled until Parser is loaded). Right now, however, I'm inclined to omit this.

Extensions to Symbol: 2. implementors and printImplementors

Method implementors returns all the compiled method which implements
the selector named by the receiver, printImplementors print these
compiled methods to the stdout.

#implementors is a nice addition, but you're missing class methods and subclasses of nil. Also there's nothing in it that requires Parser, or am I wrong?

You would need something like this:

        Class allSubclassesDo: [:c | | m |
            m := c compiledMethodAt: self ifAbsent: [nil].
            m ifNotNil: [ implementors add: m].
            m := c asClass compiledMethodAt: self ifAbsent: [nil].
            m ifNotNil: [ implementors add: m]].

#printImplementors is not very useful. A method like this in Collection (#printLines for example) would be useful instead:

    self implementors do: [:each | Transcript display: each; nl ]

You could add that instead.

Also, please include a ChangeLog entry with your patches.

Thanks in advance!  Don't be put off by the comments, it's good stuff.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]