20,741
edits
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
== 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... | |||
<syntaxhighlight lang="nasal"> | |||
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(); | |||
</syntaxhighlight> |