Bah, what would be the meaning of accepting the shebang syntax then? SCripts are made to provide a quick way to hack: you edit it for 5 mins, you run it. You change a parameter inside, you run it. Otherwise, there would be no need for scripts, everything could be compiled, even if you fill everything with system() statements.

On Saturday, 31 August 2013 at 11:08:57 UTC, Jacob Carlborg wrote:
On 2013-08-30 09:39, eles wrote:
On Linux 64

$chmod +x htest
$cat ./htest
#!/usr/bin/env rdmd
import std.stdio;

void main() {
    writeln("hello world!");
}

then:

$./htest
Error: cannot read file ./htest.d
Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'

OTOH:

$cp htest htest.d
$./htest.d
hello world!

It seems that rdmd expects the script to bear the .d extension. This is not a very good choice, at least when writing git helper scripts.

For example, a "$git command" command would eventually try to execute
the executable (script):

$git-command

The problem is that that line expects git-command, not git-command.d.

A workaround for this?

Why don't just compile it manually once instead of using like a script?

Reply via email to