Fun with Kernel :)

Stephane Ducasse ducasse at iam.unibe.ch
Fri Apr 4 15:33:31 UTC 2003


hi all

We are have fun with the kernel. here is an example.

Behavior>>firstPrecodeCommentFor: selector
	"If there is a comment in the source code at the given selector that
	preceeds the body of the method, return it here, else return nil"
	"Behavior firstPrecodeCommentFor: #firstPrecodeCommentFor:"
	| parser source tree |
	(MessageSet isPseudoSelector: selector)
		ifTrue: ["Not really a selector"
			^ nil].
	source _ self
				sourceCodeAt: selector asSymbol
				ifAbsent: [^ nil].
	parser _ self parserClass new.
	tree _ parser
				parse: (ReadStream on: source)
				class: self
				noPattern: false
				context: nil
				notifying: nil
				ifFail: [^ nil].
	^ (tree comment
		ifNil: [^ nil]) first

This method is linking the core of the kernel with a UI element. But
What I do not understand is that the symbols in isPseudoSelector:
are the one used by the browser to distinguish between some of its 
state.

MessageSet>>isPseudoSelector: aSelector
	"Answer whether the given selector is a special marker"
	^ #(#Comment #Definition #Hierarchy ) includes: aSelector



Does anybody know when the method firstPrecodeCommentFor: can be 
invoked with
those symbol???


Thanks back to fun and dark side of Squeak


Stef and Alex


Prof. Dr. Stéphane DUCASSE
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

"The best way to predict the future is to invent it..." Alan Kay.

Open Source Smalltalks: http://www.squeak.org, 
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at 
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at 
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html


More information about the Squeak-dev mailing list