Article: Why I use the D programming language for scripting
Petar
Petar
Mon Feb 1 12:11:46 UTC 2021
On Monday, 1 February 2021 at 11:10:28 UTC, Paul Backus wrote:
> On Monday, 1 February 2021 at 09:36:15 UTC, Jacob Carlborg
> wrote:
>> On Sunday, 31 January 2021 at 20:36:43 UTC, aberba wrote:
>>> It's finally out!
>>>
>>> https://opensource.com/article/21/1/d-scripting
>>
>> FYI, the code will compile faster if you use `dmd -run`
>> instead of `rdmd`. If you have multiple files that need to be
>> compiled you can use `dmd -i -run`.
>>
>> --
>> /Jacob Carlborg
>
> Unfortunately, you can't pass more than one command-line
> argument on a #! line.
It is possible, using `/usr/bin/env -S command arg1 arg2` , as of
coreutils 8.30. I have been using it at work and it's working
perfectly. This functionality was already supported by FreeBSD
[1] for ~15 years, but the coreutils developers implemented it
just ~3 years ago [2].
The main disadvantage is that it's obviously not very portable,
e.g. all users/developers need to use a modern linux distro, but
for some teams this requirement already there for other reasons,
so it's not a problem.
Example:
https://gist.github.com/PetarKirov/72168d8dc909c670444ca649ec28f80f
This was extracted from a larger project, so it may not be useful
on its own, but hopefully it should be enough to showcase the
usage.
Also, if you can use rund [3], it's likely a much cleaner option.
[1]: https://www.freebsd.org/cgi/man.cgi?env
[2]: https://lists.gnu.org/r/coreutils/2017-05/msg00020.html
[3]: https://github.com/dragon-lang/rund
More information about the Digitalmars-d-announce
mailing list