Talk:Canvas ND framework

From FlightGear wiki
Revision as of 21:39, 30 January 2014 by Hooray (talk | contribs)
Jump to navigation Jump to search

Versioning

As more and more aircraft start adopting the framework, we should consider adding some "versioning" support, so that people can request a certain version and assume a certain API that won't change over time. TheTom is already doing this in the Canvas APIs - and we basically need a similar mechanism, so that the APIs can evolve, without breaking unmaintained aircraft - redneck and omega95 were extremely frustrated with the lack of backwards compatibility when the route manager/fplan APIs were reworked, because they didn't have the time to update their aircraft - so this is a valid point and we should make sure that we're not causing any unnecessary frustration here. I am proposing a hash/namespace-based lookup for APIs, unless Philosopher can convince me that we need something more sophisticated than that...

var VersionedAPIContainer = {};
VersionedAPIContainer.new = func(version);
...


var NavDisplay = {};
NavDisplay[ "1.0" ] = VersioonedAPIContainer.new( "1.0" );

...

# request a certain API version
var ND = NavDisplay["1.0"];
ND.new();