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

Re: Assignment no, dynamic scoping si (was: Wishes for

Subject: Re: Assignment no, dynamic scoping si (was: Wishes for XSL revisions ...
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 29 Dec 2001 10:24:58 -0800 (PST)
eliminate redundancy list haskell
Gunther Schadow <gunther at aurora dot regenstrief dot org> wrote:

[snip]

> Also, to the earlier discussion about variables: once again I
> notice that your use of variables is as static bindings only,
> just like constants. You would not need any of this if the
> XSLT language had the simplicity of LISP where you could just
> use the result of one function in the application in the next
> function. The only real need for your variables is to do the
> node-set() function call, because of this split between XML
> XSLT on the outside and the XSLT-extended xpath expressions
> on the inside.

I apologise to the other readers, as what I'll be saying here is well-known.

The use of variables in XSLT 1.0 serves 4 more purposes than simply to provide a
capture for an RTF:

  1. To support the principle of abstraction. Giving a single name for complex
expression simplifies, hides (abstracts) complexity, thus making the problem easier
to solve and the solution easier to understand.

  2. As means for ***sharing***. Instead having to calculate the same expression
more than once in different parts of a program, it is calculated only once and the
result associated with a variable.

  3. To eliminate redundancy. When the same expression is present at more than one
location in a program, it is difficult and error-prone to modify, resulting in low
quality and poor maintainability.

  4. To achieve efficiency. Avoiding the re-calculation of the same expression over
and over again. The typical example of a horribly inefficient algorithm due to not
saving the intermediate results is the exponential-time calculation of a member of
the Fibonacci sequence based on the formula: f(n) = f(n-1) + f(n-2); f(0)=f(1)=1

> So, I don't let it go just yet. The variable construct in XSLT
> is not very useful and dynamic binding as at least an optional
> declareable feature would be a very, very, useful feature that
> I kindly ask to be added to XSLT next revision.
> 
> This would be declareable as:
> 
> <xsl:variable name='foo' select='bar' dynamic='true'/>
> 
> think about it or please let me know why this is so much
> felt to be such a bad idea? The implicit parameter
> paper is also based on Haskell, and people kept suggesting
> dynamic scoping as extensions to scheme. There seems to
> be a fairly strong vote by the people out there to want
> to add dynamic scoping back into languages that deliberately
> have cut that out for some theoretically righteous reasons.
> (This again is just a challenge to stir up a response,
> rather than a rant or a flame.)

First of all, any proposal for new features in XSLT must be directed to 
xsl-editors@xxxxxx

I am not feeling convinced that the new feature you're proposing is necessary or
useful at all. As other people pointed out, you have yet to provide a precise
example where using this feature will help produce a better solution or a solution,
which was not possible without the feature you propose.

It is obvious that any function with implicit parameters cannot be used as a first
class object (e.g. passed as parameter to other functions, or returned as their
result). Such functions will be difficult to combine with other functions and
generally to reuse. Using implicit parameters is analogous to using shared static
memory. Even in OOPL this is (reasonably) not considered a good practice. Using
mutable static memory leads to side effects, e.g. could impose limitations (even
serialisation) on the order of execution.

In case I were one of the respectable members of the above mentioned W3C WG, this
fact alone would weigh sufficiently not to support such a new feature. I would
advocate caution and to seriously start considering this proposal only after/if the
feature, which is now an extension to Haskell, has been incorporated into the
official Haskell98 (Haskell 2 ?) language.

Cheers,
Dimitre Novatchev.




__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.