- From: Adam Retter <adam@exist-db.org>
- Date: Sat, 3 Aug 2013 15:11:01 +0100
- To: Florent Georges <fgeorges@fgeorges.org>
- Cc: EXPath CG <public-expath@w3.org>
Looks good, I am glad we simplified on one binary type with conversion. 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? 1) Using a string for a binary value seems overkill to me, and dangerous (2)(3). 2) Using a boolean allows the compiler to statically enforce the choice. The error can be caught at compile time. 3) Developers can't put in an invalid value (typo or nonsense) e.g. "little-encidan" 4) The error code (if any) at Runtime caused by an invalid value is not detailed in the spec. It should be if there is a dynamic error. Perhaps if I am mistaken, and there are more than two octet orders, then using a string would be fine. If you are going to use a string, how about declaring two variables in the module, that define these (i.e. constants). This would could help people rely on the compiler to statically enforce their intention and guard against mistakes. Of course the same could be done for binary values to make your code more readable! e.g. bin:pack-double(12245, "LE") becomes bin:pack-double(12345, $bin:little-endian) bin:pack-double(12245, "BE") becomes bin:pack-double(12345, $bin:big-endian) Just a thought! Cheers Adam. On 2 August 2013 18:07, Florent Georges <fgeorges@fgeorges.org> wrote: > Hi, > > As some of you might have deduced from Mike's email, a new > draft of the Binary Module has been published yesterday, at: > > http://expath.org/spec/binary > > As this is a major rewrite of the previous version (thanks to > Jirka and John, and thanks to all the feedback we got from you > all), there is no diff version. > > Regards, > > -- > Florent Georges > http://fgeorges.org/ > http://h2oconsulting.be/ > -- Adam Retter eXist Developer { United Kingdom } adam@exist-db.org irc://irc.freenode.net/existdb
Received on Saturday, 3 August 2013 14:11:28 UTC