Scripting in D on Windows

Nick Sabalausky a at a.a
Thu Jan 29 21:19:46 PST 2009


"Sergey Gromov" <snake.scaly at gmail.com> wrote in message 
news:1fknfu6vto1zn.q3hbrnp5lpsk.dlg at 40tude.net...
> It is possible to make .d files automatically executable on Windows.
>
> For that you need:
> 1) modify the PATHEXT environment variable.  It's a semicolon-separated
> list of executable extensions, so you just add ";.D" at the end
> 2) create a file association for .D and make the default action for it
> of the form:
>
>  dmd -run "%1" %*
>
> Now if you have foo.d in your path, you just type 'foo' in command line
> and it runs.
>
> OK, so far so good.  But the drawback of this is that every single .d
> file becomes executable which is absolutely not what I want.  I want
> only selected, specially designed D programs to be executed when I
> mention their name.  This would be possible if I used a different file
> extension for D scripts, .ds for instance.  Unfortunately DMD chokes on
> files with unknown extensions, making this impossible.
>
> What do you think?  Would you use D for scripting?  Is it worth a
> feature request for DMD to support additional--or arbitrary--extensions
> for files executed with -run?

I'm of the mind that every language should be usable as both script and 
compiled. So in that sense, I like your proposal. Although, to be honest, I 
don't see much of a difference between doing that versus just simply 
compiling the d "script" to an executable and running that. 





More information about the Digitalmars-d mailing list