OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] An XML API using Java streams

On Thu, Jun 22, 2017 at 9:11 AM, Hans-Juergen Rennau <hrennau@yahoo.de> wrote:

(3) I do not think that an embedded expression language is per se inferior to using Java primitives. In fact, it can be an incomparably better choice. Proof: nobody would consider replacing regular expressions by calls to a Java-native "API for string navigation" (streaming or not).


The irregex library for the programming language Scheme uses just such combinators, and has been taking over the world of Scheme regular expression implementations.  Originally it was just an overlay on PCRE, but is now written entirely in Scheme — and with a good compiler is competitive with existing C implementations.  Classic regex language is more terse, yes.  But combinators are clearer, do not require two-level escapes (and so lack a whole class of vulnerabilities), and are readily extensible as needed.

Here's what irregex matching might look like in a fluent Java syntax:

sequence(exactly(3, n_to_m(numeric, 1, 3), "."),
              n_to_m(numeric, 1, 3))

where "numeric" is a standard character-set object representing [0-9].  This match will return true, whereas one against "192.0168.10.1" or "192.168.10" or "not an IPv4 address" will return false.

For more on irregex, see the latest spec at <http://srfi.schemers.org/srfi-115/srfi-115.html>.

(ObSmugLispWeenie:  Of course, Lisp languages have had garbage collection since 1960 and closures since 1975.  Perhaps in a few decades Java regular expressions will catch up as well.)

John Cowan          http://vrici.lojban.org/~cowan        cowan@ccil.org
A poetical purist named Cowan                   [that's me]
Once put the rest of us dowan.                  [on xml-dev]
"Your verse would be sweeter / If it only had metre
And rhymes that didn't force me to frowan."     [overpacked line!] --Michael Kay

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

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS