Subject: [Cbor] CDDL: Pick between "text" vs "tstr" and "bytes" vs "bstr".

From: Jeffrey Yasskin <[email-masked]>
Date: Tue, 19 Dec 2017 19:35:07 +0000

I don't think the CDDL prelude
<https://tools.ietf.org/html/draft-ietf-cbor-cddl-00#appendix-E> should
standardize two English ways to spell the same thing. I don't have a real
preference between "text" vs "tstr", but I'd like to pick one so that
people don't have to think about which one to use in our own specs.

In case nobody has a preference, I'll suggest using "tstr" and "bstr", on
the theory that the types have more in common than they differ, so it's
nice to include the similarity in the name. However, if others prefer
"text" and "bytes", I'll happily vote for that pair instead.

Jeffrey

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 19 Dec 2017 21:31:12 +0100

Hi Jeffrey,

On Dec 19, 2017, at 20:35, Jeffrey Yasskin <[email-masked]> wrote:
> 
> I don't think the CDDL prelude should standardize two English ways to spell the same thing. I don't have a real preference between "text" vs "tstr", but I'd like to pick one so that people don't have to think about which one to use in our own specs.

I agree that a single name for each of text strings and byte strings would have been good.

One observation we made with the initial choice of `tstr` and `bstr` is that these look too similar; it is too easy to mistake one for the other.  So we came up with the less cryptic `text` and `bytes`.  (A lot of people think that the text one should be called “string”; well… If you really need this to get rid of some dissonance, adding a line “string = text” to your spec will give you that.)

> In case nobody has a preference, I'll suggest using "tstr" and "bstr", on the theory that the types have more in common than they differ, so it's nice to include the similarity in the name. However, if others prefer "text" and "bytes", I'll happily vote for that pair instead.

I don’t think we should take away one of the aliases at this stage.  (But, of course, if we do that, a simple “tstr = text” or v.v. will “repair” a spec.)

We *could* express a preference, as in “tstr and bstr are aliases for backwards compatibility; text and bytes are the preferred names” or v.v.

Grüße, Carsten

---

From: Jeffrey Yasskin <[email-masked]>
Date: Tue, 19 Dec 2017 20:44:29 +0000

On Tue, Dec 19, 2017 at 12:31 PM Carsten Bormann <[email-masked]> wrote:

> > I don't think the CDDL prelude should standardize two English ways to
> spell the same thing. I don't have a real preference between "text" vs
> "tstr", but I'd like to pick one so that people don't have to think about
> which one to use in our own specs.
>
> One observation we made with the initial choice of `tstr` and `bstr` is
> that these look too similar; it is too easy to mistake one for the other.
> So we came up with the less cryptic `text` and `bytes`.  (A lot of people
> think that the text one should be called “string”; well… If you really need
> this to get rid of some dissonance, adding a line “string = text” to your
> spec will give you that.)
>
> > In case nobody has a preference, I'll suggest using "tstr" and "bstr",
> on the theory that the types have more in common than they differ, so it's
> I don’t think we should take away one of the aliases at this stage.  (But,
> of course, if we do that, a simple “tstr = text” or v.v. will “repair” a
> spec.)
>

This stage, before CDDL is an RFC, seems like the right time to bite the
bullet and pick one. If you prefer "text" and "bytes", let's do that. We
should try to avoid Stu Feldman's famous mistake with `make`. ;)

> We *could* express a preference, as in “tstr and bstr are aliases for
> backwards compatibility; text and bytes are the preferred names” or v.v.
>

Jeffrey

---

From: Jeffrey Yasskin <[email-masked]>
Date: Wed, 20 Dec 2017 00:13:40 +0000

On Tue, Dec 19, 2017 at 12:44 PM Jeffrey Yasskin <[email-masked]>
wrote:

>> I don’t think we should take away one of the aliases at this stage.
>> (But, of course, if we do that, a simple “tstr = text” or v.v. will
>> “repair” a spec.)
>>
>

Sorry for being obscure here. Stu is quoted as saying

"… I just did something simple with the pattern newline-tab. It worked, it
stayed. And then a few weeks later I had a user population of about a
dozen, most of them friends, and I didn't want to screw up my embedded
base. The rest, sadly, is history."

Jeffrey

---

From: Sean Leonard <[email-masked]>
Date: Wed, 20 Dec 2017 07:44:25 -0800

On 12/19/2017 11:35 AM, Jeffrey Yasskin wrote:
> <https://tools.ietf.org/html/draft-ietf-cbor-cddl-00#appendix-E> 
> should standardize two English ways to spell the same thing. I don't 
> have a real preference between "text" vs "tstr", but I'd like to pick 
> one so that people don't have to think about which one to use in our 
> own specs.
>
> on the theory that the types have more in common than they differ, so 
> it's nice to include the similarity in the name. However, if others 
> prefer "text" and "bytes", I'll happily vote for that pair instead.

I am for "tstr" and "bstr".

Rationale: #2 and #3 are data types for strings (sequences of symbols) 
and therefore are the same. A very cursory survey of RFCs and 
Internet-Drafts to-date:
https://www.google.com/search?q=bstr+tstr+site%3Atools.ietf.org

suggests that "tstr" is unique to CBOR-using documents in the IETF; 
"bstr" is (somewhat surprisingly) also pretty unique to CBOR-using 
documents in the IETF. BSTR (always capitalized) is also a data type in 
Microsoft products, being a binary string that can contain octets, or 
UTF-16-encoded hexadecitets [heh]. Thus bstr and tstr are, or will be, 
part of the vernacular, so folks should just learn them and move on.

"bytes" and "text" are clearly not unique to CBOR/CDDL. Furthermore, 
major tag 3 can store "bytes" (e.g., base64-encoded), and major tag 2 
can store "text" (e.g., text encoded in anything other than UTF-8, such 
as ISO-8859-1, UTF-16, etc.). Major tag 0 could be used to store a 
single byte (1-octet) or a single textual code point (1-32-bit 
UTF-32-encoded character). Finally, RFC 7049 itself uses the term 
"bytes" (as it should) to describe all CBOR encodings, so "bytes" could 
be confused with the contents of a major tag 2 item, and some complete 
CBOR encoded item, therefore being more ambiguous. So, I find the terms 
"bytes" and "text" to be imprecise, compared to tstr and bstr.

I suppose that tstr *could* be renamed to ustr for Unicode or UTF-8 
string (and a quick search suggests nobody has used ustr in any RFC or 
posted Internet-Draft), but tstr is already unique and gets the point 
across.

Regards,

Sean