ANN: StepTalk 0.9.1 - with actor prototype
Stefan Urbanek <[email protected]> Thu, 30 Jun 2005 23:24:11 +0200
| Newsgroups | gmane.comp.lib.gnustep.announce |
|---|---|
| Message-ID | <1120166651.8079.7.camel__14268.319871235$1120173255$gmane$org@stevko> |
Hi, Minor update - StepTalk 0.9.1 was released. What is StepTalk? ----------------- Language independent scripting framework for GNUstep. More information: http://mediawiki.gnustep.org/index.php/StepTalk Intro: http://stefan.agentfarms.net/Download/GNUstep/Documents/StepTalk-intro.pdf What is new in 0.9.1 -------------------- * Actor class - STActor. For more information see attached example or Examples/Smalltalk/stactor.st * fixes after GNUstep-base fixes of NSUnknownKey Note to rIO and perhaps others interested: I would like to remove all add/remove methods from the STActor and move them to STActorBuilder class. What do you think? Get it from ftp://ftp.gnustep.org/pub/incoming or later from ftp://ftp.gnustep.org/pub/gnustep/libs/ Any patches, comments and questions are more than welcome. Enjoy, Stefan Urbanek -- http://stefan.agentfarms.net First they ignore you, then they laugh at you, then they fight you, then you win. - Mahatma Gandhi _______________________________________________ Info-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/info-gnustep
actor.st
(text/plain, 1.4 KB)
| actor engine source method |
actor := STActor actorInEnvironment:Environment.
"Set ivars"
ivars := NSMutableDictionary dictionary.
ivars setObject:1 forKey:'number'.
actor setInstanceVariables:ivars.
" Get the proper engine "
engine := STEngine engineForLanguageWithName:'Smalltalk'.
" This is the source of new method "
source := 'increment
number := number + 1. ^self'.
" Create method "
method := engine methodFromSource:source
forReceiver:actor
inEnvironment:Environment.
" Add the method to the actor "
actor addMethod:method.
" Add another method with an argument "
source := 'setNumber:i number := i. ^self'.
method := engine methodFromSource:source
forReceiver:actor
inEnvironment:Environment.
actor addMethod:method.
source := 'print
Transcript showLine: (\'The number is \',
(number description)). ^self'.
method := engine methodFromSource:source
forReceiver:actor
inEnvironment:Environment.
actor addMethod:method.
" Send it! "
actor print.
actor increment.
actor print.
actor increment.
actor print.
actor setNumber:10.
actor print.