[Top][All Lists]

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

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

From: Roland Plüss
Subject: Re: [Help-smalltalk] Using Smalltalk as a scripting language
Date: Fri, 30 Oct 2009 00:09:54 +0100
User-agent: Thunderbird (X11/20090926)

>> When I get this correctly then this would be in fact gst_object_alloc(
>> oopClass, numberOfCOnlyBytes ); where numberOfCOnlyBytes is the number
>> of bytes I append to the struct which is not accessible to smalltalk. So
>> far so right?
> Yes, right.  numberOfCOnlyBytes can actually be just sizeof (void *)
> with the C data stored "on the side".  You choose (remember that if
> you place data in the Smalltalk object you have to deal with the GC
> moving the objects).
What exactly you mean with "moving"? I'm not referencing to data inside
the custom data area using pointers. Most of the time I simply store
there a pointer to the wrapped engine object. Sometimes it's two
pointers ( required if a non-ref-counted object is stored which is
located inside a ref-counted object so I store two pointers one with
ref-counting to guard the second non-ref-counted one ). So as long as
the data is just copied nothing bad should happen.
>> So I assume if I want to use this approach I have to
>> provide a cCall for #new which creates the object using the prior
>> mentioned gst_object_alloc bypassing the smalltalk creation call. Sounds
>> like quite the hack but it looks like it could work out.
> Doesn't seem to bad.  Most likely you'd have a cCall for #initialize
> anyway.  Having one for #new instead does not change much.
To my understanding ( from past smalltalk lectures at university where
we worked with Squeak ) #new is responsible for allocating an object
while #initialize or #init is responsible for setting up default values
for the newly created instance. Therefore I proposed #new. Unless that
is in GST this rule is slightly different.

Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( , )
- Game Engine: Drag(en)gine ( , )
- Normal Map Generator: DENormGen ( )

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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