Conversation
…general copy-editing. Some minor enhancements.
|
I very much like the addition of more precise definitions in the early sections, and the expansion of some of the function rules and notes and additional use of other new 4.0 features such as Other remarks/issues:
|
|
Re bin:octal - the revised spec reflects the current Saxon implementation, I believe. The 1.0 spec says
A strict reading of that says that '177' should be expanded to '00000177' which gives you 24 bits or 3 octets, but that's clearly not what it means to say. If we strip leading zero bits before padding to an integral number of octets, that would make bin:octal('0') give a zero-length binary value, which doesn't feel right either. And what should '077' give you? Perhaps the rule we're looking for is: first create a sequence of n*3 bits where n is the string length. Remove a maximum of two leading zero bits. Then add as many leading zero bits as are needed to make the bit length a multiple of 8. That's mightly complicated, but perhaps the result is more intuitive. Does anyone actually use octal? |
I do, but it's only in a PDP-11 emulator! |
|
Thanks, I've read the document and found the following issues:
|
integral number of octets clearly means bytes '177' becomes 0x7F. '77' becomes 0x3f, and '7' becomes 0x07. If the length of $in is not divisible by three, it prepends either '0' or '00' to make it divisible by three |
$in is a character string in which each character represents three bits. I'm sure you don't mean the length of the character string. I guess you mean the length of the bit-string obtained by converting to binary and removing leading zeros? But then you have to decide what to do when $in is the string '0', or '00', etc. Please review my proposal and see if it makes sense to you. |
|
The CG agreed to merge this PR at meeting 108. |
I meant the input string. I was sure the function would only accept complete octets like bin:from-octets, 3 characters for 8 bits joined together. Then |
|
The 1.0 specification of bin:octal is pretty vague, but interpreting it as groups of 3 octal digits each mapping to one octet in the result wouldn't give the right answer for the only example in the 1.0 spec. I've added a note in PR1765 that that is NOT the way it works. |
Apart from general copy-editing, the main changes are:
Fix #1750