API Evolution
bearophile
bearophileHUGS at lycos.com
Wed Feb 11 03:10:21 PST 2009
This is a bit related to the discussion about version().
In the Lambda the Ultimate blog-forum they are discussing about better support in languages for API Evolution:
http://lambda-the-ultimate.org/node/2950
In the discussion someone has said that it may be useful a syntax to specify what version of a module/package must be imported. (And now and then I have seen people in Python mailing lists ask for something similar, they have several versions of the same module/package and they want other modules to import only the right version).
A first possible raw idea:
This looks for a module foo strictly version 1.3:
import foo(1.3, 1.4) : bar;
This looks for a module foo version 1.3 or 1.4 only:
import foo(1.3, 1.4) : bar;
This looks for a module foo version 1.3 or successive:
import foo(1.3, +) : bar;
The compiler is of course supposed to look for modules by itself, as bud does, and it rises a compilation error if an acceptable version isn't available.
That idea may also need a way to define the version of the current module, a raw idea:
module foo(1.4);
A small problem is that versions of such module/package will have the same name, so you can't put them in the same directory...
Bye,
bearophile
More information about the Digitalmars-d
mailing list