On 01.05.2006 18:36, Christopher Nelson wrote:
> ---
> // Setup some helpers for the particleFountain object.
> particleFountain.Stop = function()
> {
>       var stopCmd = 0;
>       particleFountain.onEvent(stopCmd);      
> }
> 
> particleFountain.Start = function()
> {
>       var startCmd = 1;
>       particleFountain.onEvent(startCmd);     
> }
> ---

What if I want, say, two particle fountains, with identical methods etc.
but affecting e.g. two different fountains visible on screen?

> Being able to accept and post more sophisticated objects would require
> your app to be more tightly bound to the JS api.  In that case, you will
> not be using AWS2's simple interface. 

Or you could make AWS2's interface powerful enough to allow more
sophisticated objects, AWS2 would provide the necessary glue then.

> If you still feel that your idea has merit and that I am perhaps missing
> the point, please provide me with a practical use case that demonstrates
> your preferences.

Any case where you want to have two distinct objects of the same "type"?

Also, using static functions as callbacks encourages bad coding style.
Example: Your very own code where you need to access the "application"
object by using a global static variable. This is just plain bad style.
Using real C++ methods avoid that; plus, you have the option of making
your "script object" support less limited in the future (say if you get
the idea that providing a away to return new objects to JS via function
results would be nice).

-f.r.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to