updated example

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@17442 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Urbanek 2003-08-06 20:29:42 +00:00
parent c8d3797f86
commit 65335eb012

View file

@ -12,12 +12,12 @@
object := STScriptObject scriptObject. object := STScriptObject scriptObject.
object setEnvironment:Environment. object setEnvironment:Environment.
" This is the source of new method "
source := 'sayHi Transcript showLine: \'Hi.\'. ^self'.
" Get the proper engine " " Get the proper engine "
engine := STEngine engineForLanguageWithName:'Smalltalk'. engine := STEngine engineForLanguageWithName:'Smalltalk'.
" This is the source of new method "
source := 'sayHi Transcript showLine: \'Hi.\'. ^self'.
" Create method " " Create method "
method := engine methodFromSource:source method := engine methodFromSource:source
forReceiver:object forReceiver:object
@ -26,7 +26,16 @@
" Add the method to the object " " Add the method to the object "
object addMethod:method. object addMethod:method.
" Add another method with an argument "
source := 'sayHiTo:someone Transcript showLine: (\'Hi \', someone). ^self'.
method := engine methodFromSource:source
forReceiver:object
inEnvironment:Environment.
object addMethod:method.
" Sent it! " " Sent it! "
object sayHi. object sayHi.
object sayHiTo:'GNUstep'.