<div dir="ltr">Thank you, Mike.  That explanation is perfectly reasonable; this handling certainly meets the stated intention.<div><br></div><div>Joe</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Apr 14, 2018 at 2:58 PM Michael Kay <<a href="mailto:mike@saxonica.com">mike@saxonica.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As always with "why?" questions, it's difficult to know what kind of answer you want, between<br>
<br>
(a) Where does the spec say this should happen?<br>
<br>
(b) Why does the the spec say this should happen?<br>
<br>
and (b) breaks down to either<br>
<br>
(b1) Why would this be a reasonable choice for the spec-writers to make?<br>
<br>
(b2) As a matter of historical record, who proposed that it should be like this and what justification did they put forward?<br>
<br>
Regarding (a), the spec says:<br>
<br>
<quote><br>
Each item in the supplied sequence is serialized individually as follows, with an occurrence of the chosen item-separator between successive items.<br>
</quote><br>
<br>
I think it's a reasonable reading of that that adaptive(S) == string-join(S!adaptive(.), item-separator), which leads to the conclusion that the serialization of () is "".<br>
<br>
Regarding (b2), my main recollection of relevant discussions concerns streamability: specifically, it should be possible to serialize each item independently without knowing what follows. But if someone had proposed serializing () as "()", I don't think that could really have been opposed on streamability grounds. But I don't think anyone proposed it.<br>
<br>
Regarding (b1), the main clue about the WG's thinking is the sentence <br>
<br>
<quote><br>
The intention of this is to allow any valid XDM instance to be serialized without raising a serialization error.<br>
</quote><br>
<br>
So you find that the adaptive method focuses on how to serialize cases that otherwise would fail. Serializing the empty sequence wouldn't otherwise fail, so I guess it didn't receive much attention. Whether a proposal to serialize () as "()" would have been accepted is anyone's guess.<br>
<br>
Michael Kay<br>
Saxonica<br>
<br>
<br>
> On 14 Apr 2018, at 19:14, Joe Wicentowski <<a href="mailto:joewiz@gmail.com" target="_blank">joewiz@gmail.com</a>> wrote:<br>
> <br>
> Hi all,<br>
> <br>
> Many thanks, as always, for the very helpful feedback here.<br>
> <br>
> I have noticed that Saxon, eXist, and BaseX all serialize the empty sequence `()` not as `()` but instead as the empty string ``.  Sample code:<br>
> <br>
>   serialize((), map { "method": "adaptive" })<br>
> <br>
> I was expecting to see `()` because when serializing a map entry, the empty sequence is serialized as `()`:<br>
> <br>
>   serialize(map { "test": () }, map { "method": "adaptive" })<br>
> <br>
> This returns `map{"blah":()}`.<br>
> <br>
> Can anyone enlighten me on why the empty sequence is serialized as `()` in the latter context and the empty string in the former?<br>
> <br>
> Thanks,<br>
> Joe<br>
> _______________________________________________<br>
> <a href="mailto:talk@x-query.com" target="_blank">talk@x-query.com</a><br>
> <a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br>
<br>
</blockquote></div>