I'm goin through compiler sources and a new instance system is mentioned a few times in particular relating to extensions but what is the new instance system and how should it differ from the current one?
obj_0instances; we'd also have a list of
The other big plan I had for the new instance system was to encapsulate all those list globals (including the
self object global, used by, eg,
with) in a class, which would be instantiated on a per-thread basis. That would give us a much higher degree of thread safety, and allow users to create threads to run scripts (they can already do this, but it will cause crashes if they interact heavily with the instance system in any thread).
I'm intrested in this obsurd cast method here which is again casted here
surely theres a better way to do this....
The only other way to do that is to rebuild all the extensions any time the set of selected extensions changes. Or, as I said above, to maintain a list of properly-cast pointers so the extension can just iterate that list.
path_start can just be a member of the class being cast to, and GCC will handle the correct cast of the
this variable. ENIGMA's compiler doesn't currently support that, though.
In fact, perhaps what I was alluding to in whatever material you read was my intention to eventually make all the methods that operate on locals be members of the class containing those locals.
What do you mean by pointers to the extensions? pointers to the paths resources? also where would this list go
Some extensions (including paths) add local variables to all objects. They do this by declaring a class that contains those local variables, then specifying in their configuration file that
object_localsshould inherit from this class. Without knowing what
object_localsis, though, it's impossible to cast from it to the correct extension class (the compiler implements this behind the scenes as a simple pointer addition, but you still need the offset).
The list would go with the object-specific instance lists. We'd have a series of object-specific instance lists, followed by a series of extension-specific instance lists.