DeRailed DSL (was Re: compile-time regex redux)
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Fri Feb 9 18:26:42 PST 2007
kris wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Tom S wrote:
>>
>>> When the compiler is used for the processing of a DSL, it simply
>>> masks a simple step that an external tool would do. It's not much of
>>> a problem to run an external script or program, that will read the
>>> DSL and output D code, while perhaps also doing other stuff,
>>> connecting with databases or making coffee.
>>
>>
>> This is a misrepresentation. Code generation with external tools has
>> been done forever; it is never easy (unless all you need is a table of
>> logarithms), and it always incurs a non-amortized cost of parsing the
>> DSL _plus_ the host language. Look at lex and yacc, the prototypical
>> examples. They aren't small or simple nor perfectly integrated with
>> the host language. And their DSL is extremely well understood. That's
>> why there's no proliferation of lex&yacc-like tools for other DSLs (I
>> seem to recall there was an embedded SQL that got lost in the noise)
>> simply because the code generator would basically have to rewrite a
>> significant part of the compiler to do anything interesting.
>
> Are you stating that D will address all these concerns? Without any
> detrimental side-effects?
It will naturally address the concerns exactly by not relying on an
external generator. This was my point all along.
>> I think there is a lot of apprehension and misunderstanding
>> surrounding what metacode is able and supposed to do or simplify.
>> Please, let's focus on understanding _before_ forming an opinion.
>
> If that's the case, then perhaps it's due to a lack of solid & practical
> examples for people to examine? There's been at least two requests
> recently for an example of how this could help DeRailed in a truly
> practical sense, yet both of those requests appear to have been ignored
> thus far.
>
> I suspect that such practical examples would help everyone understand
> since, as you suggest, there appears to be "differences" in perspective?
> Since Walter brough RoR up, and you apparently endorsed his point,
> perhaps one of you might enlighten us via those relevant examples?
>
> There's a request in the original post on "The DeRailed Challenge" for
> just such an example ... don't feel overtly obliged; but it might do
> something to offset the misunderstanding you believe is prevalent.
I saw the request. My problem is that I don't know much about DeRailed,
and that I don't have time to invest in it. My current understanding is
that DeRailed's approach is basically dynamic, a domain that
metaprogramming can help somewhat, but not a lot. The simplest example
is to define variant types (probably they are already there) using
templates. Also possibly there are some code generation aspects (e.g.
for various platforms), which I understand RoR does a lot, that could be
solved using metacode.
On the other hand, there are many good examples coming from C++ (e.g.
most of Boost and Loki) offering good experimental evidence that
metacode can help a whole lot. I've tried to add a couple of ad-hoc
examples in posts, but I understand they can't qualify because they
don't directly and obviously help DeRailed.
Andrei
More information about the Digitalmars-d
mailing list