API Evolution

Daniel Keep daniel.keep.lists at gmail.com
Wed Feb 11 06:19:54 PST 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,
> bearophile

Couldn'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



More information about the Digitalmars-d mailing list