Re: New draft of EXPath binary module

Thanks for the elaborate new draft! Here are some more comments:

– in 5.1, it is stated that “This function behaves similarly to the
double cast xs:base64Binary(xs:hexBinary($string)).”. Does it mean
that the casts are indeed equivalent to bin:hex, or are there minor
differences?

– the name of the bin:subsequence() function may be irritating as it
returns no sequence, but zero or one xs:base64Binary item. Possible
alternative could be: bin:sub(), bin:range() or bin:split().

– personally, I would get rid of BINA0005 ($search is empty binary
data), because similar XPath/Query expressions (such as contains(),
matches(), or the "contains text" full-text expression) don’t raise
any errors for empty search strings.

– it could also be discussed if negative and out-of-bounds integer
should be rejected, or if they should be normalized to appropriate min
and max values, which is what comparable XPath functions do (e.g.:
substring('ab', -1) ). On the oher hand, I can see that more rigid
error messages may lead to better code, and it might be that the
tolerant behavior of XPath functions would be handled differently
today (?).

– as signed numbers are the default in the XQuery data model,
bin:unpack-signed-integer() could possibly renamed to
bin:unpack-integer()

– have you thought about letting the bit functions operate on octets
(xs:integer*) instead of base64? It’s surely possible to convert
integers to base64 for bit processing, but this seems to me like
taking a sledgehammer to crack a nut. I would guess that bit
operations on single numbers are much more frequent than operations on
two byte arrays with the same length, and it would really be nice to
have a syntax similar to a&b in XQuery; bin:and($a,$b) would come
pretty close to that writing. Regarding performance, if we need to
process byte arrays, I believe there are good chances for language
compilers to optimize queries like
"bin:from-octets(bin:shift(bin:to-octets (...)), 1).

– what about adding bin:unsigned-shift (which would be equivalent to
the >>> operator)?

Christian
___________________________

2013/8/1 Michael Kay <mike@saxonica.com>:
> A new draft of the EXPath binary module has been produced by my colleague John Lumley and is available for review here:
>
> http://expath.org/spec/binary
>
> Comments to
>
> public-expath@w3.org
>
> please.
>
> Michael Kay
> Saxonica

Received on Friday, 2 August 2013 22:54:01 UTC