help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language


From: Roland Plüss
Subject: Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language
Date: Sat, 31 Oct 2009 13:57:09 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090926)

>> Nice try but this won't work. I have an engine pointer and therefore can
>> not use a singleton in c++ ( although in smalltalk it becomes one ).
>> Hence I am forced to work without any static class members there. The
>> only chance I have to get this working is to somehow inject the created
>> object into the class side variable. This would by itself work if the
>> oop I assign would actually show up in smalltalk. I don't know yet why
>> it stays nil. Did I obtain the wrong c pointer? Did I declare the class
>> side variable incorrectly?
>
> No, you declared the Smalltalk struct incorrectly. 
What did I do wrong there?
> If you cannot use a static class member, use a global variable in the
> module that implements the bindings.  I just made it more clever than
> it needed to be.
I didn't state it clearly then. I can not use a static class nor a
static function nor a global variable. The entire engine does not use
globals or singleton by itself. This is what makes it a bit tricky if a
scripting language insists on not storing a user data pointer. So for
example I can have multiple instances of the engine running but each
engine instance has an own scripting environment and inside this
scripting environment the smalltalk class is a singleton. Hence I have
to attach the matching engine pointer to the matching smalltalk
instance. Now I do not plan on using multiple instances but the design
allows for this hence if possible I want to not break it.

Maybe I need to do a hack then by having a class side object which just
holds a pointer ( not the variable itself ). But then I have to provide
a #uniqueInstance: which a stupid developer could break. Not the worst
problem but to my understanding it should be possible to somehow inject
an oop from c++ into smalltalk somehow ( well, except using a #selector:
of course ).

-- 
Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( http://epsylon.rptd.ch/ ,
http://www.moddb.com/games/4057/epsylon )
- Game Engine: Drag(en)gine ( http://dragengine.rptd.ch ,
http://www.moddb.com/engines/9/dragengine )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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