[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] XPath as a stand-alone programming language
- From: Dimitre Novatchev <dnovatchev@gmail.com>
- To: Jim Melton <jim.melton@oracle.com>
- Date: Wed, 24 Oct 2012 08:47:10 -0700
Jim,
Now that I see that there is interest in this, I will consider posting
to Bugzilla.
Thank you.
Dimitre
On Wed, Oct 24, 2012 at 8:36 AM, Jim Melton <jim.melton@oracle.com> wrote:
> Dimitre,
>
> Thanks for showing us your work on this. Very interesting, I thought.
>
> You suggested some new post-3.0 XPath features in your message. A preferred
> way to let the XSLT and XML Query Working Groups know of such proposed new
> requirements would be to post them on W3C's public Bugzilla instance, using
> Product = "XPath / XQuery / XSLT" and Component = "XQuery 3.1 Requirements
> and Use Cases". (Note that there is no assurance that there will ever be
> another version of XPath, XQuery, or XSLT after the current 3.0 versions
> under development, nor that any such future version will be designated
> "3.1".)
>
> You can locate that Bugzilla instance at
> https://www.w3.org/Bugs/Public/enter_bug.cgi
>
> Hope this helps,
> Jim
>
>
> At 10/24/2012 07:32 AM, Dimitre Novatchev wrote:
>>
>> A few months ago I had the pleasure to do "all XPath programming".
>>
>> I developed the Binary tree data type and the Set data type
>> essentially completely in XPath 3.0.
>>
>> These can be found in my blog, respectively at:
>>
>>
>>
>> http://dnovatchev.wordpress.com/2012/01/09/the-binary-search-tree-data-structurehaving-fun-with-xpath-3-0/
>>
>> and
>>
>>
>>
>> http://dnovatchev.wordpress.com/2012/01/12/the-set-datatype-implemented-in-xpath-3-0/
>>
>> At the time this happened accidentally. I don't like to work with
>> XQuery, but at that time Saxon's XSLT 3.0 processor didn't fully
>> implement higher order functions. Saxon's XQuery 3.0 did, so I
>> reluctantly used XQuery 3.0 in my work. Doing so, I planned to move my
>> whole code to XSLT 3.0 --whenever Saxon's XSLT 3.0 processor was ready
>> for this (and now, in version 9.4 it is). Therefore I essentially
>> coded everything as much in pure XPath 3.0 as possible.
>>
>>
>> This experience clearly showed to me that it is possible to use XPath
>> 3.0 as a stand-alone programming language. This has many benefits, and
>> one of them is that XPath-only code is fully transferrable between
>> XSLT and XQuery.
>>
>> At the end of my latest blog post "Recursion with anonymous (inline)
>> functions in XPath 3.0", I list a number of nice features we still
>> need in XPath as a programming language, that could be added in a
>> future, post-3.0 version:
>>
>> 1. Stand-alone XPath processors.
>>
>> 2. Import/include directives for XPath-only files (expression-files).
>>
>> 3. Separate packaging/compilation of XPath-only programs.
>>
>> 4. New data structures such as tuples.
>>
>> 5. Generics – parametric data types.
>>
>>
>> Cheers,
>>
>> Dimitre
>>
>>
>>
>>
>> On Wed, Oct 24, 2012 at 4:55 AM, Costello, Roger L. <costello@mitre.org>
>> wrote:
>> > Thanks a lot Michael for the explanation. Fantastic!
>> >
>> > Below is a summary of my question plus Michael's answer (slightly
>> > expanded).
>> >
>> > The XPath 3.0 specification says this:
>> >
>> > XPath 3.0 is a composable language
>> >
>> > What does that mean?
>> >
>> > It means that every operator and language construct allows any XPath
>> > expression to appear as its operand (subject only to operator precedence and
>> > data typing constraints).
>> >
>> > For example, take this expression:
>> >
>> > 3 + ____
>> >
>> > The plus (+) operator has a left-operand, 3. What can the right-operand
>> > be? Answer: any XPath expression! Let's use the max() function as the
>> > right-operand:
>> >
>> > 3 + max(___)
>> >
>> > Now, what can the argument to the max() function be? Answer: any XPath
>> > expression! Let's use a for-loop as its argument:
>> >
>> > 3 + max(for $i in 1 to 10 return ___)
>> >
>> > Now, what can the return value of the for-loop be? Answer: any XPath
>> > expression! Let's use an if-statement:
>> >
>> > 3 + max(for $i in 1 to 10 return (if ($i gt 5) then $i*3 else $i*2)))
>> >
>> > The fact that XPath is a composable language is very cool and very
>> > powerful.
>> >
>> > Contrast this with XSLT, which is not fully composable: XPath
>> > expressions can be used as operands to XSLT instructions, but not the other
>> > way around. Similarly Java has constructs called statements that
>> > cannot be nested inside expressions.
>> >
>> > /Roger
>>
>> >
>> > --~------------------------------------------------------------------
>> > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>> > To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>> > or e-mail: <mailto:xsl-list-unsubscribe@lists.mulberrytech.com>
>> > --~--
>> >
>>
>>
>>
>> --
>> Cheers,
>> Dimitre Novatchev
>> ---------------------------------------
>> Truly great madness cannot be achieved without significant intelligence.
>> ---------------------------------------
>> To invent, you need a good imagination and a pile of junk
>> -------------------------------------
>> Never fight an inanimate object
>> -------------------------------------
>> To avoid situations in which you might make mistakes may be the
>> biggest mistake of all
>> ------------------------------------
>> Quality means doing it right when no one is looking.
>> -------------------------------------
>> You've achieved success in your field when you don't know whether what
>> you're doing is work or play
>> -------------------------------------
>> Facts do not cease to exist because they are ignored.
>> -------------------------------------
>> Typing monkeys will write all Shakespeare's works in 200yrs.Will they
>> write all patents, too? :)
>> -------------------------------------
>> I finally figured out the only reason to be alive is to enjoy it.
>>
>> _______________________________________________________________________
>>
>> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
>> to support XML implementation and development. To minimize
>> spam in the archives, you must subscribe before posting.
>>
>> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
>> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
>> subscribe: xml-dev-subscribe@lists.xml.org
>> List archive: http://lists.xml.org/archives/xml-dev/
>> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>
> ========================================================================
> Jim Melton --- Editor of ISO/IEC 9075-* (SQL) Phone: +1.801.942.0144
> Chair, ISO/IEC JTC1/SC32 and W3C XML Query WG Fax : +1.801.942.3345
> Oracle Corporation Oracle Email: jim dot melton at oracle dot com
> 1930 Viscounti Drive Alternate email: jim dot melton at acm dot org
> Sandy, UT 84093-1063 USA Personal email: SheltieJim at xmission dot com
> ========================================================================
> = Facts are facts. But any opinions expressed are the opinions =
> = only of myself and may or may not reflect the opinions of anybody =
> = else with whom I may or may not have discussed the issues at hand. =
> ========================================================================
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]