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

mipri mipri at minimaltype.com
Tue Dec 3 02:02:08 UTC 2019


On Tuesday, 3 December 2019 at 01:28:00 UTC, bachmeier wrote:
> On Monday, 2 December 2019 at 22:18:06 UTC, mipri wrote:
>
>> A script is a file with source code in it that you can execute.
>> The essential feature of scripts is that the source code is
>> what
>> you're executing.
>
> If you include compiler directives inside the file, you're
> *not* executing the code, because you're adding code to tell
> the compiler what to do with the file.

There's no operational difference. The user types ./foo, stuff
happens. If the user edits foo and then types ./foo again,
something different happens. The illusion break for D is that
some invocations are slower than others due to compilation
overhead. Python had (or has) the same effect, though less
noticeable, with its .pyc cache files. This is bearable and
compiler directives do not change it in any way.

> You lose portability
> once you add compilation information.

This is actually an offensively ridiculous concern.

>> In deployed systems, on servers, in other people's code, when
>> you come across a binary that you have a problem with, it can
>> be
>> a long adventure to find the source of that binary, and then
>> you
>> may still have not found *the* source to *the* binary, but just
>> *some* source that could create similar binaries. For example,
>> if you find a repo link in a near by document, what commit to
>> that repo was used to build the binary that you have?
>
> You can add a comment explaining how to compile the code.

Comments are not code, and when you compile a script you get a
binary, not a script. The exact same problems can arise: I have
a problem with this binary and the source is nowhere to be
found. Or I have a problem with this binary and the nearby
script has a comment that may or may have not been followed to
build it.

> The
> proposed change to rdmd would require a bunch of added
> complexity,

Adding code adds complexity. This is true.

> probably introduce bugs

Adding code probably adds bugs. This is also true.

> duplicating Makefile functionality.

Makefiles have nothing to do with scripts.

> Let's leave currently
> working tools alone.

rdmd is not a "working tool" when your task requires some
compiler flags.

This level of scare-mongering about some trivial array
manipulation is absurd to the point that I actually start to
suspect malicious intentions. Who sent you and how much are
they paying you? Suppose a General asked for input on how to
assault a position, and a Colonel responded by waxing about the
very serious hazards posed by the very small rocks to be found
in the desert near the position? "Why, if a soldier were to
kneel down during the battle to inspect one of these rocks, he
might scratch a finger. It is also conceivable that some
arrangement of small rocks might make for slippery footing. For
these reasons we should take the much more heavily defended
western approach, which--"

Are you serious? Are you actually serious?



More information about the Digitalmars-d mailing list