Thread overview
restrictions for compiler code
Oct 10, 2016
Rémi Thebault
Oct 10, 2016
Johan Engelen
Oct 10, 2016
Johan Engelen
Oct 10, 2016
Rémi Thebault
October 10, 2016
Hello all

I'd like to contribute D code to LDC, but I don't know what restrictions apply in the compiler code.

 - is it allowed to link to Phobos?
 - is it allowed to link to Druntime?
 - is it allowed to link to external D libraries that meet the 2 above
restrictions?

Thanks
Rémi
October 10, 2016
On Monday, 10 October 2016 at 05:43:35 UTC, Rémi Thebault wrote:
> Hello all
>
> I'd like to contribute D code to LDC,

Great! Welcome :-)

> but I don't know what restrictions apply in the compiler code.
>
>  - is it allowed to link to Phobos?
>  - is it allowed to link to Druntime?

Both yes. For example:
https://github.com/ldc-developers/ldc/blob/master/driver/ir2obj_cache_pruning.d#L23-L24

However, I think you should only use functionality that is well-established and stable, so that chances are small that things will break in the future.
Also note that because LDC "LTS", the last LDC version that is not written with D code,  ships with Phobos v2.068.2, so that's the newest functionality that you can use.
https://github.com/ldc-developers/ldc/releases/tag/v0.17.0

>  - is it allowed to link to external D libraries that meet the 2 above
> restrictions?

I am against using external libraries, because it complicates the build considerably. For example, we currently have libconfig as an external dependency and I would much like to get rid of it.

Anything specific you are thinking of contributing to LDC?

cheers,
  Johan

October 10, 2016
On Monday, 10 October 2016 at 09:52:37 UTC, Johan Engelen wrote:
> 
> For example, we currently have libconfig as an external dependency and I would much like to get rid of it.

Is this written by you perhaps?
https://github.com/rtbo/libconfig-d

:D


October 10, 2016
Le lundi 10 octobre 2016 à 10:11 +0000, Johan Engelen via digitalmars- d-ldc a écrit :
> Is this written by you perhaps? https://github.com/rtbo/libconfig-d
> 
> :D

Yes indeed!
I still need to check if it builds with phobos v2.068.2. (and may be
downgrade the code if needed)

libconfig-d depends on Pegged for parser generation. Pegged is really great, but we need to keep the build process transparent, and I want to be the least invasive possible.

Options:
 - rewrite a dedicated parser (should not be too difficult)
 - add Pegged as a submodule along with libconfig-d in a new 3rdparty
folder (or directly under driver/)
 - prepare a specific libconfig-ldc repo that also contains necessary
code from Pegged. (not great for maintainance)

In all cases I'll need to add a submodule somewhere.

regards,
Rémi