importing and compiling squeak code

Alan Lovejoy squeak-dev.sourcery at forum-mail.net
Mon Feb 7 06:41:03 UTC 2005


Brett:

To compile a method in a class, execute the following code:

	YourClass compile: methodBodyString classified: #methodCategory

So, to add the method #foo to the class Object, under the method category
#bar, where the body of the #foo method prints 'Foo, world!' to the
Transcript, you would code the following:

	Object 
		compile: 'foo
				Transcript cr; show: ''Foo, world!'''
		classified: #temporary

--Alan



-----Original Message-----
From: squeak-dev-bounces at lists.squeakfoundation.org
[mailto:squeak-dev-bounces at lists.squeakfoundation.org] On Behalf Of Hart's
Antler
Sent: Sunday, February 06, 2005 10:09 PM
To: squeak-dev at lists.squeakfoundation.org
Subject: importing and compiling squeak code

Hi, i am new to Squeak and smalltalk, i'm hoping somebody can help me get
started on this problem.
 I want to store some squeak code in a file and execute the code after the
program is running,
binding all of the methods found in that file to a new object.  I am
starting with something like
below:

bindMethods bindToObject compile: text
    ...something here to compile the text and return the methods?
    ...something here to bind those methods to bindToObject?


Thanks,
-brett


		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 






More information about the Squeak-dev mailing list