xsl-list
[Top] [All Lists]

The real harm is in functions with side effects (Was: Re: Using Extension Functions - Its Efficiency)

2004-01-15 22:52:14

"Joshua Allen" <joshuaa(_at_)microsoft(_dot_)com> wrote in message
news:0E36FD96D96FCA4AA8E8F2D199320E52BA807D(_at_)RED-MSG-43(_dot_)redmond(_dot_)corp(_dot_)microsoft(_dot_)com(_dot_)(_dot_)(_dot_)
Well, doing so partially defeats the purpose of using XSLT, since it
means your stylesheets will not work in many other systems.  It begs the
question, if you find that Java is needed, then why use XSL at all?  Why
not just write the app in Java?

In any case, if you want to still use XSL and be as portable as
possible, I would recommend using the exslt templates at www.exslt.org
before giving up and writing your own extensions.

Portability is not the main issue with using extension functions.

In many cases an application is designed to work only within a certain known
platform/environment (e.g. intranet), which is not going to change.

However, even in this case uncontrolled use of extension functions can be
dangerous. What I am referring to is that many people are not aware of the
harm that functions with side effects may cause in a functional language.

In many cases the "need" to use an extension function is due only to the
fact that the programmer comes from a procedural background and simply does
not want to learn the functional way of programming -- and not because there
is no way to do this without extension functions.

Due to this reason some nice-looking proposals for new extension functions
(which happen to have side effects) have not been accepted by the management
of the EXSLT.org group.

We need to have a special section in the XSLT FAQ about extension functions
and why functions with side effects are generally harmful in a functional
language.


Dimitre Novatchev.
FXSL developer,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html




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