Re: [GD-General] Re: C++ turing complete
Brought to you by:
vexxed72
From: Patrick M D. <pa...@wa...> - 2001-12-24 04:45:48
|
On Sun, 23 Dec 2001, Jesse Jones wrote: > I have a vague recollection of a more practical definition of a > Turing complete language. It went something like: a language is > Turing complete if it has sequential statements, some form of if > statement, and I think one other thing that I can't recall. Probably recursion - that should be sufficient to make it Turing-complete. This is a limiting definition though as those behaviors aren't strictly necessary. > >Regardless, templates provide an expressive meta-language for static > >compilation. I'll admit that I don't fully understand the excitement as > >one can do this in a more powerful (and understandable) fashion by simply > >generating C++ code. > > 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. 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. 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. At least C++ template syntax is not as bad as Unlambda. Patrick |