drepl icon indicating copy to clipboard operation
drepl copied to clipboard

Integrate dub

Open MartinNowak opened this issue 11 years ago • 4 comments

Allow to fetch and use dub packages.

MartinNowak avatar Feb 12 '14 17:02 MartinNowak

This should also work for the online REPL.

MartinNowak avatar Feb 19 '14 02:02 MartinNowak

I made something related to this https://github.com/ShigekiKarita/grain/blob/master/example/repl.d

ShigekiKarita avatar Aug 15 '18 01:08 ShigekiKarita

I'd think of dub integration as some form of :dub mir command that will fetch and compile mir as shared library that will be linked against in D module for that command. Afterwards modules from that package can be imported. So it'd would be an interactive addition of dub modules.

You're appproach looks interesting, but it has a flaw. It statically links packages into every subsequent D module, i.e. you'll end up with dozens of copies of the package. That will break the One Definition Rule. You really need to compile packages as shared libraries to avoid this. Atm. dub's support to compile packages as shared libs is still not fully there, e.g. dependencies need to be shared libs as well to avoid ODR issues.

MartinNowak avatar Aug 20 '18 14:08 MartinNowak

ODR

Thanks for pointing out. I have not thought about it. Maybe also compiling separate static library like tmp/_dubdeps.a only with DUB packages and tmp/_mods%s.so without DUB packages can avoid ODR?

ShigekiKarita avatar Aug 20 '18 17:08 ShigekiKarita