Re: Assignment no, dynamic scoping si (was: Re: [xsl] RE: Wishes for XSL revisions ...

Subject: Re: Assignment no, dynamic scoping si (was: Re: [xsl] RE: Wishes for XSL revisions ...
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 3 Jan 2002 14:12:09 GMT
Gunther

> So, what are the disadvantages of dynamic scoping?
> I can see only two

There are others, not least that having two kinds of scoping working in
parallel is confusing. There are languages that do this but normally one
has either one sort of scope or the other. Especially in XSLT dynamic
scope could have some surprising consequences due to the template match
mechanism.

Unlike some other more traditional languages, in XSLT the calling order
of the templates is not at all explict in the program source and is
driven by whatever document is passed in as data.  This means that
normally templates need to be written to work wherever they happen to
match and _without_ regard to the particular calling sequence that
caused them to fire. Dynamic scope would radically change that and mean
that the behaviour of a template would much more directly depend on the
stack of "currently active" templates. It is not at all clear to me that
this would make XSLT an easier language to understand or work with.
At present any dependency on previously called templates is (a) rare and
(b) explictly flagged by the declaration and passing or parameters.
This is a good thing (I believe) Of course the fact that the syntax for
passing parameters is so verbose (even by XSL standards) means that it
is sometimes a pain, but there have been some "syntactic sugar"
proposals to help with that without changing the underlying execution
model.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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


Current Thread