digitalmars.D - API Evolution
- bearophile (17/17) Feb 11 2009 This is a bit related to the discussion about version().
- Daniel Keep (17/29) Feb 11 2009 Couldn't you just compile with a specific version? I don't see a reason
- Chad J (4/39) Feb 11 2009 This kind of thing would be awesome, whether it be by language builtins
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
Feb 11 2009
bearophile wrote: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). [snip] Bye, bearophileCouldn't you just compile with a specific version? I don't see a reason for the language to support this when D currently doesn't even have the concept of libraries. If anything, this should be a candidate feature for DSSS. Maybe you could do it like so: version( build ) { // Obviously, you'd only use ONE of these... pragma( library_version, derelict.gl, "1.3.*" ); pragma( library_version, derelict.gl, "1.3.*", "1.4.*" ); pragma( library_version, derelict.gl, "1.3+" ); } import derelict.gl; DSSS could then download and install the appropriate version if it isn't already present. -- Daniel
Feb 11 2009
Daniel Keep wrote:bearophile wrote:This kind of thing would be awesome, whether it be by language builtins or by DSSS. It's also the kind of thing I might just get frustrated and write at some point. DSSS needs to act a bit more like portage ;)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). [snip] Bye, bearophileCouldn't you just compile with a specific version? I don't see a reason for the language to support this when D currently doesn't even have the concept of libraries. If anything, this should be a candidate feature for DSSS. Maybe you could do it like so: version( build ) { // Obviously, you'd only use ONE of these... pragma( library_version, derelict.gl, "1.3.*" ); pragma( library_version, derelict.gl, "1.3.*", "1.4.*" ); pragma( library_version, derelict.gl, "1.3+" ); } import derelict.gl; DSSS could then download and install the appropriate version if it isn't already present. -- Daniel
Feb 11 2009