Michel Fortin wrote:
On 2010-05-07 13:55:34 -0400, Walter Bright <newshou...@digitalmars.com> said:

Source code could look something like:

     import http.d_repository.foo.version1_23;

and the compiler could interpret "http" as meaning the rest is an internet url, foo is the package name, and version1_23 is the particular version of it.

So now, each time a new version of a library pops up you need to search-replace the version number for all your source code, and source code of other library you depend on? This is insane.

Not at all. Some builds want to peg the code against a specific version, so they encode that in the path. Some others may just want to use the latest, so they'd import http.d_repository.foo.current. On the server, current is always aliased to the latest.

This scheme is used everywhere on Unix.

The version number shouldn't be there, except perhaps if it's a 'major' version number full of breaking changes.

When I delivered my book, my publisher asked me to send them all LaTeX packages I used. I replied, "they're the system-provided packages coming with LiveTeX x.y.z". They insisted they need the exact files so they have them. It's not at all uncommon (albeit sad) that software is built for a very specific version of some software. My employer has huge issues m

Also, putting in the source code the location or protocol to fetch the repository isn't much better. There's a reason we have a module import path: so that finding external code depends on compile-time configuration, not on the actual code you build.

That's a good point. At a minimum, there should be the possibility to define aliases like this:

alias http.erdani.com.tdpl.code tdpl;
...
import tdpl.stuff;

Then the alias definition becomes a unique point of maintenance. Unfortunately something like that doesn't currently work, so if the online modules feature is introduced, we need to introduce such aliases as well.

Allowing URLs in the import path might be an interesting idea though.

Yah. Unfortunately other languages don't have it so it's difficult to learn from others' experience.


Andrei

Reply via email to