[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: snmpconf issue #1: language versioning



Another way to approach this problem would be to forget about language 
versioning and talk only about specific features. Let us assume that in the 
in Version 2 of the language we add two new features to the language, 
featureA and featureB and remove featureX. (Aside: the word "deprecate" 
would be incorrect here, since deprecate just means the feature might be 
removed in the future and that its use is therefore discouraged. When a 
feature is removed, it has moved from "deprecated" to "unavailable.")  In 
Version 3, we add featureC and we change featureY in a way that is 
sometimes incompatible with Version 1.

The following are flawed:

capmatch(Version1)  might cause a perfectly-good script to fail if featureA 
or featureB are not used.

capmatch(Version2) might cause a script to fail on Version3 for no good reason.

Here are better tests:

capmatch(newFeatureA)    true on version 2 and 3 (and future versions)
! capmatch(removedFeatureX)  true only on version 1
! capmatch(v3FeatureY)   true on versions 1 and 2, but not 3 and over.
capmatch(v3FeatureY)   true on version 3 and over.

Get it?  By assigning a capability to each new, changed, or removed 
feature, we can test for only those features that will make our script work 
or fail. Any other feature can be assumed to be backwards compatible.

If, instead we added one capability for the version, then how do you test 
for "version 3 or later?"  One possibility would be to say that version 3 
must also include the capability for version 2. If a feature was removed in 
version 3, then you would test for

capmatch(Version2) && ! capmatch(Version3)

This would accomplish what I described above, but with fewer separate 
capability objects. It might be a bit confusing, though, to have a version 
2 capability on a version 3 system if it is not 100% backwards compatible.

This brings up the issue of an implementation supporting multiple versions 
of the Policy language. My question is how would you indicate which version 
of the language you want to use? It's one thing to abort the script when 
using the wrong version, it's another thing to somehow set the interpreter 
mode to the correct supported version.

- Pablo
----------------------------------------------------------------------
Pablo Halpern                      http://www.halpernwightsoftware.com
phalpern@newview.org