Scripting in D on Windows

hasen hasan.aljudy at gmail.com
Sun Mar 1 13:45:40 PST 2009


Sergey Gromov wrote:
> 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 like the idea!

I think for general purpose scripting I'd rather use python, BUT the 
importance of this idea is that it abstracts away all the compilation 
stages!



More information about the Digitalmars-d mailing list