discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: StepTalk and object construction.


From: stefan
Subject: Re: StepTalk and object construction.
Date: Fri, 11 Feb 2005 15:35:56 +0100
User-agent: Internet Messaging Program (IMP) 3.2.2

Hi,

The StepTalk has changed a bit. See below.

Citát Matthew D Swank <akopa@comcast.net>:

> I originally posted this to gnu.gnustep.help; however this list seems to
> get a bit more traffic.
> ------------------------------------------------------------
> (Note I am using cvs -q -d
> ":ext:anoncvs@savannah.gnu.org:/cvsroot/gnustep" update -dP -D 20041203
> gnustep/dev-libs/StepTalk)
> 
> I tried the following example code from ESUG2003 slides:
> | object method source engine |
>    object := STScriptObject scriptObject.

Insert here:

    env := STEnvironment environmentWithDefaultDescription.
    object setEnvironment: env.

>    engine := STEngine engineForLanguageWithName:'Smalltalk'.
> 
>    source := 'sayHi Transcript show: \'Hi.\'. ^self'.
>    method := engine methodFromSource:source
>                     forReceiver:object
>                     inEnvironment:Environment.
> 
>    object addMethod:method.
>    object sayHi.
> 
> with stexec and I receive the error:
> "stexec: Uncaught exception STInterpreterGenericException, reason: No 
> execution environment set"
> 
> I can get the method to execute 'manually' by using 
> "executeMethod:forReceiver:withArguments:inEnvironment:".
> Why can't I get it to work as written?
> 


The object should be put inside some execution context (environment). Therefore
you have to create the context, for example with default description, and put
the object there by assigning the context to the object.

Unfortunately, concept documentation of StepTalk with some diagrams was not yet
written...

Regards,

Stefan Urbanek




reply via email to

[Prev in Thread] Current Thread [Next in Thread]