Javascript: Versioning worldscripts
Posted: Wed Nov 16, 2016 7:16 am
Hi dev team,
From the information on the Wiki: if multiple world scripts of the same name are loaded one is arbitrary chosen and the rest are discarded. Also, this.version is copied from manifest.plist in 1.79+
This seems a bit silly to me. I have many "common" functions in my OXPs which I am keeping in a single script. If I make a "my-oxp-utilities" script which one OXP uses, then release another OXP with an extended (but backwards compatible) version of "my-oxp-utilities", I would have no choice but to give it a new name, since I can't be sure Oolite will use the more recent version instead of the older one.
Surely it makes more sense to merge the duplicate copies based upon a higher version number? The onus, of course, being on the author to ensure backwards compatibility with previous versions. To make life even easier, you could perhaps use a new property. Ie: this.internalVersion or this.revision, which must be a Number or else it is assigned Number.MIN_VALUE. It would at least give us some more compile-time code reuse
alaric.
From the information on the Wiki: if multiple world scripts of the same name are loaded one is arbitrary chosen and the rest are discarded. Also, this.version is copied from manifest.plist in 1.79+
This seems a bit silly to me. I have many "common" functions in my OXPs which I am keeping in a single script. If I make a "my-oxp-utilities" script which one OXP uses, then release another OXP with an extended (but backwards compatible) version of "my-oxp-utilities", I would have no choice but to give it a new name, since I can't be sure Oolite will use the more recent version instead of the older one.
Surely it makes more sense to merge the duplicate copies based upon a higher version number? The onus, of course, being on the author to ensure backwards compatibility with previous versions. To make life even easier, you could perhaps use a new property. Ie: this.internalVersion or this.revision, which must be a Number or else it is assigned Number.MIN_VALUE. It would at least give us some more compile-time code reuse
alaric.