Is metaprogramming useful?

Steve Horne stephenwantshornenospam100 at aol.com
Tue Nov 28 22:05:08 PST 2006


On Tue, 28 Nov 2006 09:31:23 -0500, Brad Anderson <brad at dsource.org>
wrote:

>P.S.  Please no ignorant replies about Lisp is interpreted or Lisp is slower
>than the imperative languages.

No - I already did that a few years ago on comp.lang.python. I'm less
ignorant these days.

I have tried to learn Scheme on many occasions, though, and only ever
got so far. Sure, it has that key mechanism there, but learning to use
the language is a bit like learning C++ by first learning how to write
asm blocks, and finding no teacher who is ever willing to teach you
the high level tools you need for real everyday work. Fine, you can do
anything, but why do you always have to reinvent all those wheels?

The thing is that in the real world, most programmers need a standard,
familiar dialect which has all the everyday high level tools available
from the start. If OOP is an immediately useful concept, programmers
should be using OOP from day one, not learning how to reinvent OOP
from the basic building blocks. So, has anyone created widely-used
standard librarys for high level programming?

On that XLR site referenced by Leandro in the "Thesis on
metaprogramming in D" thread, a reference is made to the problem of
dialects in what they call concept-oriented programming. They seem to
be getting at some other dialect-related issue, but one dialect issue
is simply that if everyone has the ability to invent their own type of
object orientation, their own type of generic, etc etc then there you
don't really have a single language. XLR takes the view that a
standard implementation is provided for each concept, and you should
only roll your own concept if you need it, but has that
standardisation been done for Scheme or other Lisp-alikes?

Of course in a sense you have a new dialect every time you switch
libraries in any language. The dialect of C++ where you use GTK or QT
for GUI stuff is very different from the dialect where you use Win32,
for instance. But there is at least common ground - terms like 'class'
and 'object' have exactly the same meaning.

Whenever I go looking for this standard set of concepts for Scheme or
whatever, I can't find it. There's a very low level core library, in
the sense of only providing very basic tools, and that's it. Of course
there are plenty of libraries out there, but...

1.  They tend to be higher level building blocks rather than useable
    concepts. You get things like PGG for partial evaluation and
    Essence for LR parsing, which are great if you want to create your
    own extension to Scheme with higher level concepts, but the leap
    to actually creating usable, standardised higher level programming
    tools using these things does not seem to have been made.

2.  They don't seem to be widely used standards. They seem to be
    mainly academic experiments. For instance, you can find academic
    papers about them descibing the theory behind them and conclusions
    resulting from implementing them and testing them out with
    contrived examples, but no user guides or tutorials.

So sure, you can in theory make Lisp work more-or-less like Pascal or
C, but with the option to work differently when needed, but that's a
lot of work to do from the basic Lisp-alike building blocks. So where
is that standard high level programming concepts library?

-- 
Remove 'wants' and 'nospam' from e-mail.



More information about the Digitalmars-d mailing list