[Newbies] What's the relationship between scripts and methods?

Bert Freudenberg bert at freudenbergs.de
Wed Apr 8 20:10:29 UTC 2009


On 08.04.2009, at 20:28, Steinar Bang wrote:

> The scripts, converted to code, kind of look like like methods.
>
> What are the relationship of scripts and methods?  Are scripts  
> instance
> level methods?

Yes.

>  I see two possible implementations for this:
> - the eToys objects could have a system dictionary of methods as an
>   instance value?
> - eToys objects could be singletons of a new class created on the fly?

The latter. They are instances of subclasses of class Player. Usually  
they are singletons, unless you create "siblings" which are instances  
of the same class and so share all scripts.

You can actually see the scripts in the class browser (although there  
was a bug so that script methods did not show up properly, fixed in  
update #2210 scriptCatFix-sw).

> Or are scripts code blocks associated with the instance in some other
> way?


Nope.

- Bert -




More information about the Beginners mailing list