Yeah, sure - but the real issue a different one, a structural one, because it is next to impossible to reuse that kind of code in a sane fashion, which already is a long-standing challenge most aircraft-side Nasal code is facing, and which is contributing to other problems.
I do understand why and how this affects the "GC pressure" - I actually once documented the Nasal GC:
http://wiki.flightgear.org/How_the_Nasal_GC_worksHowever, I also once helped port Gijs' original ND code, and it didn't support multiple independent instances and was highly aircraft specific, that's the kind of thing we generally want to avoid.
For the technical background, refer to the article that I added to the wiki after rewriting Gijs' code accordingly:
http://wiki.flightgear.org/Howto:Coding ... #VariablesJust to be very clear about it: the only reason why so many aircraft can use Gijs' NavDisplay (ND) is the fact that it is NOT using that approach anymore.
Thus, I would suggest to tread very carefully here. Necolatis seems to have a coding background, so he surely understands the repercussions of using this approach - but most people will not realize that they are sacrificing reusability by using variables like that - unless they're willing to use hashes or vectors to put their instance-specific state there.
Thus, before pursuing this, please do make sure that you understand the repercussions - for example, here's a wiki article that I put together after looking at some aircraft code a while ago:
http://wiki.flightgear.org/Howto:Start_ ... s_in_NasalAnd it basically looked like this:
- Code: Select all
var wp1 = 0;
var wp1alt = 0;
var wp1dist = 0;
var wp1angle = 0;
var wp1length = 0;
var wp1id = "";
var wp1brg = 0;
var wp2 = 0;
var wp2alt = 0;
var wp2dist = 0;
var wp2angle = 0;
var wp2length = 0;
var wp2id = "";
var wp2brg = 0;
var wp3 = 0;
var wp3alt = 0;
var wp3dist = 0;
var wp3angle = 0;
var wp3length = 0;
var wp3id = "";
var wp3brg = 0;
var wp4 = 0;
var wp4alt = 0;
var wp4dist = 0;
var wp4angle = 0;
var wp4length = 0;
var wp4id = "";
var wp4brg = 0;