On Sunday, 24 February 2013 at 00:25:46 UTC, Jonathan M Davis
wrote:
On Saturday, February 23, 2013 16:09:43 H. S. Teoh wrote:
BTW, is "std.process2" just the temporary name, or are we
seriously
going to put in a "std.process2" into Phobos? I'm hoping the
former, as
the latter is unforgivably ugly.
In previous discussions, it was agreed that future replacement
modules would
simply have a number appended to them like that (e.g. std.xml2
or
std.random2). I don't think that that decision is irreversible,
but unless
someone can come up with a much better name, I'd expect it to
stick, and it
has the advantage of making it very clear that it's replacing
the old one.
- Jonathan M Davis
That is a really really really bad idea! There are much better
versioning methods out there.
import "std.process"; // uses latest version by default or file
name exact match
import "std.process"[3 > ver >= 2]; or
import "std.process"[hash == hashid];
would be a better way. Module file names could have attached
versioning info similar to how MS does it.
process.hash.versionid.otherattributes
The attributes are matched only if they are used, else ignored.
Hence
process.hash.version.otherattributes.d
process.d
would be logically identical(and throw an error if in the same
dir and no attribute matching used) but one could specify
attribute matching to narrow down the choice. (or the latest
version could be used by default and a warning thrown able
multiple choices)
This allows one to keep multiple versions of the same module name
in the same dir. It helps with upgrading because you can easily
switch modules(one could set global matches instead of per
module).
One could also have the compiler attach the latest match on the
import so each compilation uses the latest version but it does
not have to be specified by the user. When the user distributed
the code it will have the proper matching elements in the code.
e.g.,
import "std.process"[auto]; // auto will be replaced by the
compiler with the appropriate matching attributes. Possibly
better to specify through a command line arg instead.
Another thing one can do to help is to have the compiler
automatically modify the source code to include what module it
was compiled with by hash and or version.
When the code is recompiled a warning can be given that a
different version was used.