Re: Java vs C++
On 02/06/2011 09:00 PM, Lawrence D'Oliveiro wrote:
In message<iimnes$dh2$1@news.eternal-september.org>, Joshua Cranmer wrote:
It's a macro generator that understands types and is heavily integrated
with the syntax of C++, but it is basically a way to automatically
generate code.
You seem to be confusing one particular way of implementing
generics/templates with the way the language feature is specified. Java
generics could be implemented by a preprocessor that spat out first-edition
Java code, for that matter. In fact, it effectively does, since the JVM
seems to know nothing about generics. Would you then say that third-edition
Java is nothing more than a ???macro generator????
I make a minor distinction between syntactic sugar--a language feature
which is designed to replace specific syntax features for ease of coding
(e.g., for-each loops)--and macro processing, which is generally
unrestricted code or text generation. Generics are syntactic sugar, in
that it only generates code in a "few" select places as opposed to
wholesale code production.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth