[Top][All Lists]

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

Re: [Gnash-dev] Static Members

From: Rob Savoye
Subject: Re: [Gnash-dev] Static Members
Date: Sat, 11 Mar 2006 12:07:31 -0700
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

Michael Carlson wrote:

However, if the static member is a variable which is non-constant
(which fortunately none I've encountered so far are - maybe none are -
but can the user define a variable like this that is?), this would
cause problems as each instance of the class would have its own
separate version of the variable. Furthermore, at the moment the
constructors are all created as an as_value (of type function), which
seems to be unable to have arbitrarily named "members" like objects do

You can make members that have variable references, not just function pointers. For instance length is a static member of several classes that gets set to an integer value like this:

    obj->set_member("length",             length);

If length was static or global, then it'd work the way you want it to. If the value of length changes after you've set the member, then yeah, it probably would only return the original value.

The other way to do this would be to have length be a function pointer, and it'd just return the value of the same static data so you'd get the current value if it changed. If all classes use the same function pointer set to length, then they'd be sharing the data.

        - rob -

reply via email to

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