On Thu, 22 May 2014 02:08:14 GMT, zhaopuming wrote:

Hi Sönke,

I think this is generally a very worthwhile direction to go. Regarding the @require("scriptlike"); approach, I think the only way to make this work would be to pre-process the source code and actually replace those lines with actual import statements before passing it to the compiler. But that would be not so pretty (IMO) for the reason that it would tie it to DUB as a build tool.

The current idea was to use a specially formatted comment instead of UDAs, because that may be easier to parse and doesn't require additional work to keep the source code a valid D program. See #103 and this thread for some basic ideas.

Yes, I like the Comment idea :-) I chose UDA only because it makes this dependency mechanism more like a language feature (see node.js), and that would be good to newbies.

So this has been proposed earlier in that thread in a different use case. Happy to know that people needs this.

UDAs definitely look more friendly. We could also use custom pragma()s, such as:

pragma(dub_dependency, "scriptlike: ~>1.0.0");
import scriptlike.something;

.. maybe nicer semantics that using comments, but with considerable syntax overhead.

But inverse way was also one of the ideas - DUB would search for import statements and query the registry for matching packages. Additional comments or pragmas could be used for fine tuning (selecting specific version ranges).

A minor issue would be that import module name might not be the same with registered dub package name, adding another indirection.

But overall i think this approach is better.

Yes, there are also definitely potential ambiguities here, so there still needs to be a way to explicitly state which package is required.

Basically what is missing is just a complete, well thought out proposal, before it can be implemented.

Where should we put proposals about DUB, create a D(ub)IP ?

The DIP-like idea sounds nice. I've created a little wiki page for this (Using DUB Enhancement Proposals for the lack of a better name).