On Mar 1, 9:33 pm, "Phlip" <phlip2...@gmail.com> wrote:
> Farbeit from me to defend Kaz, but my projects are either different, or I
> re-use mycodeon them.
>
> Their differences should go into metadata and scripts, and their
> commonalities should merge into a core, typically accessed by an API using a
> DSL. A good system for this is called "Software Product Lines".
>
> So this suggests that we should prefer languages that make DSLs easy.
Maybe, but not necessarily in the general case -- there are many other
reasons to prefer certain languages over others: familiarity and
appropriateness for the task at hand being the two biggest reasons I
can think of. A general preference for certain types of languages in
all situations isn't a good idea. It may be difficult, say, to develop
a DSL on top of an existing DSL, but that doesn't mean we should
prefer to not use DSLs in general (for example). We should prefer
languages that let us express the problem we're trying to solve as
clearly and concisely as possible. (When I say "languages" I don't
mean just ones you would type with characters, I also mean tools like
a code-generating GUI editor, or something like Max/MSP, which also
let you express problems albeit in a more graphical sense -- it's hard
to build a DSL on Max/MSP but Max is still a good tool for certain
types of tasks).
> [snip] ... Putting
> acodegenerator over a hard language would create a big impedence mismatch.
> As soon as you need something the generator can't do, you switch languages.
Yes, but if you are using a code generator where you consistently have
to "step outside" of it and add lower-level code, you are probably
using the wrong tool for the job. For example, if you are using flex
but you consistently hand-edit the generated state machines (or
whatever) by adding various features that you can't express in flex,
you may want to consider not using flex (especially if you have to end
up reapplying the same modifications every time you modify the
original flex input). On the other hand, a good code generator would
integrate well into the underlying language and would allow you to
"safely" do things the generator could not do by adding low-level code
that didn't conflict with what the generator was doing. For example,
ratfor (the old Fortran preprocessor), or FLUID (
http://www.fltk.org/
shots.php - FLTK's drag-and-drop GUI editor) -- both of these let you
use the code generator as a convenient tool to help with a task,
rather than giving you a "tool" with a lot of limitations that you
must consistently fight with (there are many "bad" tools like this
around, as well -- I see it a lot especially in programs designed to
generate source from UML, for some reason).
Jason