Re: [GD-General] Re: C++ turing complete
Brought to you by:
vexxed72
From: Jesse J. <jes...@mi...> - 2001-12-24 07:55:58
|
At 11:45 PM -0500 12/23/01, Patrick M Doane wrote: >On Sun, 23 Dec 2001, Jesse Jones wrote: > > > Well, there's a lot of value in being able to generate the code from >> within C++. It's more portable and convenient than using something >> like Perl and it's better integrated with the other parts of the >> language. > >There other ways to generate code besides Perl--consider a parser >generator like Yacc. Sure, but none of these are as tightly integrated with C++ as templates. This seems to me to limit their applicability. And, I'd note, that there are many more heavy duty template libraries than code generating systems like Yacc. >One could probably implement this using template >meta-programming techniques, but I'm sure that Yacc can give much better >error messages and provides a syntax that is easier to use than templates. Probably. If you haven't read it you might want to check out a book called "Generative Programming". It has several very interesting chapters including a good chapter on template meta-programming. >Integration with the language is nice, but it's a pity that it comes at >such a high price to the syntax. This becomes especially noticeable when >compared with similar systems in Lisp or Camlp4. Yep, I think part of the problem was that templates were designed for things like containers and algorithms. From what I've read the functional programming aspects came as a surprise. The committee is talking about a few things like typeof that would make meta-programming a bit easier, but AFAICT it's going to remain an activity practiced by only a few people. -- Jesse |