shebang launcher for D programs

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Fri Mar 23 20:39:45 PDT 2007


Bruno Medeiros wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Anders F Björklund wrote:
>>> Andrei Alexandrescu (See Website For Email) wrote:
>>>
>>>> In short, rundmd does what rdmd does but works on multi-module 
>>>> programs.
>>>>
>>>> I suspect other people have written similar scripts, but just in 
>>>> case, I thought I'd ask. If people are interested, I'll be glad to 
>>>> comb the script a little and post it here.
>>>
>>> Rebuild has a similar feature (-exec), but it's a program not a script.
>>> I think build/bud also did, but I had problems with it and GDC/Tango...
>>
>> Sounds great. Where is rebuild? (Bud aka build is easy to find on 
>> dsource.org).
>>
>>> Not sure how you pass runtime / program arguments over to it, though ?
>>> But it does parse and compile all the imported modules for the program.
>>
>> (The way I do it is simple but ambiguous - any flags that come before 
>> the program name are passed to dmd, and any stuff that comes after the 
>> program name is considered that program's arguments. The program name 
>> is the first thing without a leading "-".)
>>
>> I think such a tool should be part of the standard distribution - it's 
>> very, very useful.
>>
>>
>> Andrei
> 
> I agree, from first hand experience. I've made some D scripts myself, 
> and there are some modules that I use often in such D scripts, such that 
> I had to create a shell script wrapper to automatically include those 
> module libs in D script compilation. (although I guess I could have put 
> them in the shebang line as well, but that was more annoying)

Finally :o). I was surprised by the responses to this topic, which
basically revolved around the theme "Tool X and tool Y could be changed
to do that". For me, the availability of a simple shebang script that
takes care of'em all made a very inconvenient problem just disappear,
and I also think that making such a tool part of the standard
distribution would reduce the entry barrier to D enormously.

Which brings me to the question: what is the project style with D that
people use? What tool(s) do you use, and in what sequence?  The way I
currently do things is, I have a bunch of modules in a directory tree
and I import them in whichever programs I'm writing. I edit the program,
save it, and then just start it (the .d program; the fact that object
files and a binary executable are generated is entirely transparent) 
from the command line. I never need to explicitly compile or build 
anything, and I only see any messages (such as gcc's link command) when 
the program has an error.


Andrei



More information about the Digitalmars-d mailing list