[ANN] MetaclassTalk 0.3 alpha 2 is available

Noury Bouraqadi bouraqadi at ensm-douai.fr
Wed Jul 17 12:04:14 UTC 2002


I noticed that due to a prior bug and the order of fileIn, the
original source code does not appear in some example classes (Person and
Professor).
Instead the decompiled code is shown on the browser (it shows
the transformed + wrapped code).

The bug was already fixed in the release. All you have to do
is to fileIn again the examples (file MetaclassTalkExamples.st
herewith).
I updated the MetaclassTalk download page with a fixed version.

BTW, I have a bug that couldn't fix. When installing sources, 
Squeak asks for initials on fileIn the last file
(MetaclassTalkMixinsExamples.st). 
Any hint?

Rgards
-- 
------------------------------------------
Dr. Noury Bouraqadi
Ecole des Mines de Douai - Dept. G.I.P
http://csl.ensm-douai.fr/noury
------------------------------------------
-------------- next part --------------

StandardClass subclass: #TracerClass
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MetaclassTalk-examples'
	metaclass: StandardClass!
!TracerClass commentStamp: 'Noury Bouraqadi 6/6/2002 15:04' prior: 0!
"Noury Bouraqadi 6/6/2002 15:02"

A TracerClass is a class that traces all behavior of its instances.
That is tracing all read/writes to instances variables, messages sendings
or reception, method lookup  and method application.

The trace is written on the Transcript.
If no view of the transcript is available, a new one is opened.
!


!TracerClass methodsFor: 'structure control'!
allocate
	"Noury Bouraqadi 6/6/2002 14:57"
	"Answers a new object"
	"Ensure that there is at least one view of the Transcipt open"

	Transcript dependents isEmpty ifTrue: [Transcript open].
	^super allocate! !

!TracerClass methodsFor: 'structure control'!
atIV: ivIndex of: instance
	"Noury Bouraqadi 6/6/2002 15:05"
	"Answers the value of the Instance Variable whose index is ivIndex"

	Transcript cr; 
		show: 'Reading IV ';
		space;
		show: (self ivName: ivIndex);
		show: ' in an instance of ';
		show: self name;
		cr.
	^super atIV: ivIndex of: instance
! !

!TracerClass methodsFor: 'structure control'!
atIV: ivIndex of: instance put: newValue
	"Noury Bouraqadi 6/6/2002 15:05"
	"Answers the value of the Instance Variable whose index is ivIndex"

	Transcript cr; 
		show: 'Writing value ';
		show:  newValue printString;
		show: ' into IV ';
		show: (self ivName: ivIndex);
		show: ' in an instance of ';
		show: self name;
		cr.
	^super atIV: ivIndex of: instance put: newValue
! !


!TracerClass methodsFor: 'message control'!
apply: cm to: receiver arguments: args
	"Noury Bouraqadi 6/6/2002 15:04"
	"Answers the result of applying method cm on receiver using the arguments args"

	Transcript cr; 
		show: 'Applying method: ';
		show: cm selector;
		show: ' on an instance of: ';
		show: self name;
		cr.
	^super apply: cm to: receiver arguments: args! !

!TracerClass methodsFor: 'message control'!
lookupFor: selector receiver: receiver superSend: superFlag originClass: originCl
	"Noury Bouraqadi 6/6/2002 15:17"
	"Answers the method that have the given selector and that takes the given arguments.
	Answers nil if no such method is found."

	| searchClass |
	searchClass _ self lookupStartClass: originCl superSend: superFlag.
	Transcript cr; 
		show: 'Looking for method named: ';
		show: selector;
		show: ' starting atClass: ';
		show: searchClass name;
		cr.
	^super lookupFor: selector receiver: receiver superSend: superFlag originClass: originCl
 ! !

!TracerClass methodsFor: 'message control'!
receive: selector from: sender to: receiver arguments: args superSend: superFlag originClass: originCl
	"Noury Bouraqadi 6/6/2002 15:20"
	"Sends a message form sender to receiver.  
	Answers the result of the message.  
	When the receiver is super, the superFlag is set to true.  
	The orginCl is set to the class where lookup should start.  
	Otherwise originCl is set to nil which means that the lookup should start 
	form the receiver's actual class"

	Transcript cr; 
		show: 'An instance of: ';
		show: self name;
		show: ' received message: ';
		show: selector.
	superFlag 
		ifTrue: [Transcript 
			show: '. Message sent to super in class: ';
			show: originCl name]
		ifFalse:[ 
			receiver == sender 
		ifTrue:[Transcript show: '. Message sent to self']
		ifFalse:[Transcript
			show: ' from an instance of: ';
			show: sender class name]].
	Transcript cr.
	^super receive: selector from: sender to: receiver arguments: args superSend: superFlag originClass: originCl
! !

!TracerClass methodsFor: 'message control'!
send: selector from: sender to: receiver arguments: args superSend: superFlag originClass: originCl 
	"Noury Bouraqadi 6/6/2002 15:20"
	"Sends a message form sender to receiver.  
	Answers the result of the message.  
	When the receiver is super, the superFlag is set to true.  
	The orginCl is set to the class where lookup should start.  
	Otherwise originCl is set to nil which means that the lookup should start 
	form the receiver's actual class"

	Transcript cr; 
		show: 'An instance of: ';
		show: self name;
		show: ' sent message: ';
		show: selector.
	superFlag 
		ifTrue: [Transcript 
			show: '. Message sent to super in class: ';
			show: originCl name]
		ifFalse:[ 
			receiver == sender 
		ifTrue:[Transcript show: '. Message sent to self']
		ifFalse:[Transcript
			show: ' to an instance of: ';
			show: receiver class name]].
	Transcript cr.
	^super send: selector from: sender to: receiver arguments: args superSend: superFlag originClass: originCl
! !

TracerClass initialize!

Object subclass: #Person
	instanceVariableNames: 'name age '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MetaclassTalk-examples'
	metaclass: TracerClass!
!Person commentStamp: 'Noury Bouraqadi 6/10/2002 17:37' prior: 0!
"Noury Bouraqadi 6/10/2002 17:37"

Demonstrate the tracing... Evaluate the following code.
The Person/Prof objects behavior is to interact through Popups.
Since Person is an instance of TracerClass all performed operations
(access to instance variables, method sends, receptions, 
method lookup and application) are traced on the transcript.
This tracing acts only on instances of Person and not on thoses
of Professor since Professor is NOT an instance of Trancing
(its metaclass is StandardClass).

	"|joe prof|
	Transcript clear.
	joe _ Person new name: 'Joe' age: 25.
	prof _ Professor new name: 'Brian' age: 32.
	joe chatWith: prof"
!


!Person methodsFor: 'accessing'!
age
	"Noury Bouraqadi 6/6/2002 15:54"

	^age! !

!Person methodsFor: 'accessing'!
name
	"Noury Bouraqadi 6/6/2002 15:54"

	^name! !

!Person methodsFor: 'accessing'!
name: newName age: newAge
	"Noury Bouraqadi 6/6/2002 15:52"

	name _ newName.
	age _ newAge! !


!Person methodsFor: 'chatting'!
answerAge
	"Noury Bouraqadi 6/6/2002 15:54"

	PopUpMenu notify: self name, ': I''m ', self age printString
! !

!Person methodsFor: 'chatting'!
answerHello: aPerson
	"Noury Bouraqadi 6/6/2002 15:54"

	PopUpMenu notify: self name, ': Nice to meet you ', aPerson name! !

!Person methodsFor: 'chatting'!
askAgeOf: aPerson
	"Noury Bouraqadi 6/6/2002 15:54"

	PopUpMenu notify: self name, ': how old are you ', aPerson name, '?'.
	aPerson answerAge
! !

!Person methodsFor: 'chatting'!
chatWith: aPerson
	"Noury Bouraqadi 6/6/2002 15:54"
	"|joe prof|
	joe _ Person new name: 'Joe' age: 25.
	prof _ Professor new name: 'Brian' age: 32.
	joe chatWith: prof"

	self sayHelloTo: aPerson;
		askAgeOf: aPerson! !

!Person methodsFor: 'chatting'!
sayHelloTo: aPerson
	"Noury Bouraqadi 6/6/2002 15:54"

	PopUpMenu notify: self name, ': Hello ', aPerson name.
	aPerson answerHello: self! !


Person subclass: #Professor
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MetaclassTalk-examples'
	metaclass: StandardClass!

!Professor methodsFor: 'accessing'!
name
	"Noury Bouraqadi 6/6/2002 16:45"

	^'Prof. ', super name! !

Person initialize!
Professor initialize!


More information about the Squeak-dev mailing list