I've been thinking of using Squirrel as a scripting language.
My idea was to use the garbage collector as a memory manager:(squirrel as an example script)
class Model
{
constructor(filename)
{
model_id = load_model(filename);
}
destructor()
{
unload_model(model_id);
}
model_id = null;
}
Something like this.(load_model and unload_model is native functions that are really easy to bind no need to worry about binding complicated classes)
It's obvious that this isn't going to work. Because Squirrel is missing the destructor.
Am I thinking of something wrong?
Is there a reason why Squirrel doesn't have a destructor?
Am I just using scripting in a wrong way?
Are there any alternatives to Squirrel that is similar to it but with a destructor?
Should I rethink the problem with binding to the native functions?