RE: RE: Is xsl:for-each "syntactic sugar"?
> In the book, Structure and Interpretation of Computer > Programs by Abelson, Sussman, and Sussman, the authors assert > that looping constructs (such as xsl:for-each) are syntactic sugar: Well, they don't use that term, and you haven't defined it. It's true that xsl:for-each is a redundant construct added to the language for usability reasons, not to increase the computational power of the language. If that's what you mean by syntactic sugar, so be it. On the same token, the "+" operator is syntactic sugar, because it could have been written as "--". However, I think the term "syntactic sugar" has overtones that don't apply here. There's a sense that "real programmers don't need syntactic sugar", and also a sense that compilers are likely to strip off the syntactic sugar and immediately rewrite the construct using the underlying primitive. But implementations are more likely to optimize a recursive function by compiling it into an iteration (using tail call optimization) than to compile an iteration into a recursive function. To my mind this makes the term "syntactic sugar" a little misleading: and I note that the passage you cite doesn't use it. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format