[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] [Musing] User Preference for Functional Programming


Subject: Re: [xsl] [Musing] User Preference for Functional Programming
From: Liam R E Quin <liam@xxxxxx>
Date: Wed, 10 Jul 2013 13:54:49 -0400

On Wed, 2013-07-10 at 10:32 -0700, Hank Ratzesberger wrote:

> 
> I am only conversing here, I hope not to take your time if you are not
> interested.

Do not worry: you pose an interesting and useful question.

[...]
>   awardType.getAwardID().getAwardContractID().setModNumber(fpdsInfo.getModNum());

vs:

>   /award/awardID/awardContractID/modNumber=FpdsInfo:modNum

> 
> And a colleague spoke to me and said, 'Well, I much prefer action
> words, they explain what is happening'

Well, your first example is much close to a modern programming idiom, so
it will have a high comfort factor. Your second, by the way, would be
greatly improved with spaces around the = sign.

There are two intermingled questions here:
. which syntax is preferred
. which semantics are preferred.

But the two approaches are also not mutually exclusive. For example,
what if you write,

xpath("/award/awardID/awardContractID").setModNumber(fpdsInfo.getModNum());

Now there's a declarative part embedded in a procedural part. You could
go one step further,

xpath("/award/awardID/awardContractID") .
               setModNumber( xpath("FpdsInfo:modNum") );

Both the .set/.get and the XPath syntx are domain-specific languages,
but people come to them with different expectations.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml


Current Thread
Keywords