logo       

Re: add method from Workspace?: msg#00065

lang.smalltalk.squeak.beginners

Subject: Re: add method from Workspace?

Don,

Open the message names browser and search for compile: . You'll most likely find the methods compile: , compile:classified: and compile:in:classified: most interesting. As a quick example, execute the code below in a workspace, it will add the instances method myMethod to the String class in the category 'complie-example'.

String compile: ' myMethod ^ ''testing'' ' classified: 'compile-example' .

Note that you will have to escape quotes... I hope this helps.

Travis

Don McLane wrote:
How can I add a method to a class from the workspace? Adding a class is
easy, just send a message to the superclass. FileIn does it all the
time, but I can't seem to do it with any variation of the format in a
.st file.

For the curious: the reason I want to do this is to make a classroom
demonstration go more smoothly.

Thanks,
Don McLane


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



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise