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

Re: A more fundamental concept than functions: units ofcode th

  • From: David Carlisle <davidc@nag.co.uk>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Tue, 18 May 2010 00:04:10 +0100

Re:  A more fundamental concept than functions: units ofcode th
On 17/05/2010 23:27, Costello, Roger L. wrote:
> Do you agree that self-selecting units of code represents a more fundamental concept than functions?
>

Not really. the dynamic application provided my xsl:apply templates is 
clearly a powerful thing and removing that power (and so adding new 
possibilities for optimisation) is essentially the only difference 
(other than cosmetic syntax differences) between xquery and xslt.

But templates are just functions, with a particular type of overloading.


In xpath you can have multiple functions of the same name, which one is 
applied depends (only) on the number of parameters. That restriction 
though is merely a language restriction in Xpath not a fundamental 
restriction on the concept of "function". A great many computer 
languages allow functions to be overloaded not just on arity but on the 
type of their arguments. XSLT template matching can be seen (if you want 
to see it that way) as a generalised form of function overloading not 
just  on the types of the arguments but on arbitrary predicates on the 
argument.

hence your example

   <xsl:template match="Book[Publisher lt 1970]">

     <xsl:template match="Book[Publisher eq 1970]">

     <xsl:template match="Book[Publisher gt 1970]">


however the difference between selecting based on type and selecting 
based on predicates is mostly a matter of viewpoint rather than 
substance as is the difference between types and predicates


http://en.wikipedia.org/wiki/Propositions_as_types_principle

David


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.