How do people feel about putting source compiler directives inside rdmd?

Petar Petar
Tue Dec 3 17:16:07 UTC 2019


On Tuesday, 3 December 2019 at 14:01:07 UTC, bachmeier wrote:
> On Tuesday, 3 December 2019 at 09:46:59 UTC, Petar Kirov 
> [ZombineDev] wrote:
>> On the contrary. Without compiler directives or a tool that 
>> has them built-in, like dub or rdmd/rund you don't have any 
>> portability, because you have no idea how run build the 
>> script. It's ridiculous to expect just the right set 
>> dependencies to be magically installed on the system where the 
>> script will run.
>
> None of this is relevant if you have a tool that is limited to 
> running code that doesn't need compiler directives. I'm aware 
> that some people think you have to add every feature to every 
> tool. I disagree. Especially in cases where the functionality 
> is already provided by other tools.

I don't follow, are you arguing that worse is better? Why would 
one use an inferior tool, if there's another one providing a 
strict superset of features (or at least a superset of the ones 
that one needs) at the same level or better performance?

Unless one is in the unlikely position of writing a single source 
file (with no imports/includes) bare-metal application I don't 
see a situation where one doesn't have any dependencies. Even 
shell scripts have implicit dependencies on things like the shell 
interpreter (dash vs bash vs zsh vs fish vs ...), its version, 
the available executable files in $PATH, other environment 
variables, and other things.

Instead, I believe every program meant to be used by more than 
one person should contain complete dependency information, so 
building and running it is completely reproducible. For example, 
I was one of the supporters of a Dub feature [0] using which you 
specify the requirements on the D toolchain like this:

   toolchainRequirements dub=">=1.14.0" frontend=">=2.080 <2.090"

This one of reason why I use NixOS [1][2][3].

[0]: 
https://dlang.org/changelog/2.085.0.html#toolchain_requirements
[1]: https://nixos.org/
[2]: https://nixos.org/nix/
[3]: https://nixos.wiki/wiki/NixOS




More information about the Digitalmars-d mailing list