Christopher Smith on 5 Jun 2003 22:14:01 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [ALACPP] Notes -- Chapter 3


On Thu, 2003-06-05 at 14:46, Kevin Scaldeferri wrote:
> Continuing through Alexandrescu (chapter 3 now), the thought that keeps
> coming to me is, why not just write in a functional language? The
> techniques of template meta-programming draw so heavily from functional
> techniques; so much that to someone familiar with them, the term
> "meta-programming" just sounds like hype. If you were using a more
> powerful programming language, there wouldn't be anything "meta" about
> it. I mean, he talks about typelists as if they were the second coming,
> but there's nothing remarkable about them. Virtually every language
> other than C can do it without the need for all these gymnastics.

So, interestingly enough, Glasgow people apparently now have felt the
need to add a templating mechanism to the Haskell language:

http://www.haskell.org/ghc/docs/latest/html/users_guide/release-6-0.html

I think the magic of type lists is more from how they interact with
other feature of the compile in order to do things *at compile time*.
While most functional languages have some form of meta
programming/lazy-evaluation that gives the compiler this kind of power,
you tend not to have it outside the functional world. To list off a few
languages where you'd have to do all this magic at runtime:

Java (well, until the next JDK, and even then a lot of the magic is done
at runtime)
Objective-C
Python
Perl
Smalltalk
Modula-3
C#
VisualBasic (can you finally do this kind of stuff with VB.NET?)

I'm not even sure how you'd do this in Pascal, but it's been a while
since I've done Pascal.

> Interesting question. We know that OCaml is essentially as fast as C for
> a wide variety of simple benchmarks. I wonder if there are any
> comparisons for more real life applications.

I will try to bone up on OCaml. I've been wanting to anyway.

-- 
Christopher Smith <x@xxxxxxxx>
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp