Kevin Scaldeferri on 7 Jun 2003 07:24:01 -0000 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [ALACPP] Notes -- Chapter 3 |
On Thursday, June 5, 2003, at 03:12 PM, Christopher Smith wrote:
On Thu, 2003-06-05 at 14:46, Kevin Scaldeferri wrote:Continuing through Alexandrescu (chapter 3 now), the thought that keepscoming to me is, why not just write in a functional language? Thetechniques of template meta-programming draw so heavily from functionaltechniques; 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" aboutit. 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 saw that in the kuro5hin discussion, but haven't had a chance to look into why they decided to add them. I wonder if it's just syntactic sugar or some fundamentally new addition.
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:
Right. I didn't mean to imply that the capabilities were quite identical. Doing this stuff at compile time is nifty, but runtime reflection is nearly universal.
Although, interestingly, I was just reviewing the O part of OCaml last night and discovered that runtime reflection is basically completely missing from the language. The tutorial I was looking at had some contorted exception-throwing mechanism they suggested for the cases where you might really need to (re)discover the true type of an object at runtime.
_______________________________________________ alacpp mailing list alacpp@xxxxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/alacpp