Is D a useful programming language for the web?

Nick Sabalausky a at a.a
Sat Mar 6 15:27:47 PST 2010


"Chad J" <chadjoan at __spam.is.bad__gmail.com> wrote in message 
news:hmul75$qsm$1 at digitalmars.com...
> Nick Sabalausky wrote:
>>
>> ...
>>
>> D's great for web, *if*, as the programmer, you're lucky enough to have a
>> high degree of control over the server. Usually you aren't that lucky. 
>> Which
>> actually happens to be one of the main motivating factors for my Goldie
>> project ( http://www.dsource.org/projects/goldie ). Eventually I want to 
>> get
>> it to a point where it can handle languages like D and PHP, and have a
>> strong, ultra-flexible and generalized AST system that knows how to 
>> emulate
>> one set of language features with some other set of language features, so 
>> I
>> can automate translation from whatever the hell language I want (say, D) 
>> to
>> whatever the hell language I want (say, PHP). ...
>
> You sir, are a hero.
>

Heh, thanks :)

> Question though, why not just have llvm emit code in another language?

A few (admittedly not very big) reasons, in no order:

- I wanted some experience writing lexer/parser code on my own.

- LLVM's written in, umm, either C or C++, not D, and I'd rather not have to 
deal with C/C++ (*especially* if it involves string manipulation) or 
D<->C/C++ bindings if I don't have to (I spent years with C/C++...then I 
found D. I'll be very happy if I never have to go back).

- AIUI, LLVM's intermediate representation is very low-level, so high level 
code generated from it would be pretty much unreadable and bear no 
resemblance to the original code. This is certainly fine for many uses, but 
I wanted to take a more generalized approach, to allow for more basic source 
manipulations than just language translation (such as customized 
pretty-printing and whitespace-stripping), or to act as the first step in 
maintaining a port of some app/lib in another language, or to allow for 
"language-tweaking", such as "python with curly-brace scoping", or "VB with 
semicolon statement-terminators" (The motivation and ideal goal behind this 
is to make many langauge feature debates as pointless as a debate on what 
tabsize your editor should use). Yea, it's very ambitious, and as such, I 
have no idea how it'll actually turn out. But I think it's at least worth 
attempting.

Goldie's really aiming to be more of an evolved ANTLR rater than something 
like LLVM. The closest competing project to Goldie would probably be Gazelle 
(or an ultra-souped-up version of GOLD Parser Builder, which Goldie is 
currently oriented around, or something like JetBrains MPS, but not tied to 
a single IDE and not so insanely slow and bloated).





More information about the Digitalmars-d mailing list