[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE: Is xsl:for-each "syntactic sugar"?

Subject: RE: RE: Is xsl:for-each "syntactic sugar"?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 7 May 2010 18:25:34 +0100
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 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.