Re: New draft of the Binary Module

I like to avoid booleans for function signatures since code like 
bin:pack-double(12245, true()) is obscure.  Your suggestion of a 
constant is OK, but would probably get ignored by a lot of users.  I 
understand the concern about the need for dynamic checking of the value, 
though: How about defining a subtype of xs:string (bin:byte-order) that 
is only allowed to take on the two values ("BE", "LE")?  I'm probably 
not as conversant with the XQuery type system as I could be, but would 
that make the restriction easier in any way?

-Mike

On 8/3/2013 10:11 AM, Adam Retter wrote:
> Only comment, and its a minor one, is about static interpretation of
> the $octet-order parameter to some functions.
> If this parameter can only hold one of two possible values, i.e. Big
> or Little Endian. Would it not make more sense to use an xs:boolean? -
> e.g.
>
> bin:pack-double(12245, "LE")   becomes  bin:pack-double(12345, "false")
> bin:pack-double(12245, "BE")   becomes   bin:pack-double(12345, "true")
>
> As Little Endian is the default that equates to false() and Big Endian
> would equate to true(). So why should we make this change?
>

Received on Saturday, 3 August 2013 14:53:11 UTC