This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Variables and constants


At 08:16 AM 2/25/2000 -0500, John Lam wrote:
>This is more of a philosophical question. Since I haven't worked with
>functional programming languages before, can anyone explain to me the
>rationale for not having true variables a'la procedural programming
>languages (i.e. you can re-assign the value of an existing variable)?

Yes, it is rather a philosophical question. There was much debate about it 
here on the list when the first Working Draft of the spec to mention it 
first appeared.

David Carlisle just mentioned, in a reply to another message, XSLT's 
"side-effect-free" nature, and it applies here too. The "instructions" in 
an XSLT stylesheet are not true procedural instructions, in the manner of 
those found in procedural languages, but simple *declarations* of an effect 
to be achieved in the result tree given some condition in the source. This 
means that an XSLT processor doesn't need to process the instructions in 
any particular order -- again, very different from procedural languages. 
And if the instructions aren't processed in any particular order then the 
notion of a variable whose value may from time to time be reassigned 
becomes practically useless. In a procedural language, a variable's value 
can be relied on only at the point of reference -- which of course changes 
if you change the order of execution.

In general, I agree that developers accustomed to procedural-language 
conventions need to make a conceptual leap to use XSLT effectively. (And 
the term "variable" is only the tip of the iceberg.) But this list is 
peopled with dozens of such developers who've made the leap and been 
delighted with what they've learned.

(All just my opinion, of course.)

================================================================
John E. Simpson          | I'm having amnesia and deja vu at the
http://www.flixml.org    | same time. I think I've forgotten
simpson@polaris.net      | this before.  (Steven Wright)



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]