cbor-wg / edn-literal

Application-oriented literals for CBOR extended diagnostic notation
Other
0 stars 7 forks source link

Immediate application literals for newer tags #23

Closed chrysn closed 10 months ago

chrysn commented 10 months ago

This document was overtaken by RFC9164.

Should we have ipv4"192.168.0.1" and ipv6"2001:db8::1" as application literals for that document, or do we wait for anyone to step up with that in a later document? (I didn't check whether there are any other recent good tags that'd need this).

Also, what's the recommendation for those defining such application literals? Should ipv6"2001:db8::1" map to h'20010db800......01', or to 54(h'20010db8......01')? (I'm leaning toward the former, because I'd guess that tag 54 would often be used in ~ form).

cabo commented 10 months ago

This document was overtaken by RFC9164.

Should we have ipv4"192.168.0.1" and ipv6"2001:db8::1" as application literals for that document,

Well, it would be ipv4'192.168.0.1' and ipv6'2001:db8::1' (single quotes).

Hmm, why not ip'192.168.0.1' and ip'2001:db8::1'?

Also, what's the recommendation for those defining such application literals? Should ipv6"2001:db8::1" map to h'20010db800......01',

This.

or to 54(h'20010db8......01')? (I'm leaning toward the former, because I'd guess that tag 54 would often be used in ~ form).

Right.

cabo commented 10 months ago

Maybe there should be syntax for evoking a tag (could be used for dt'', too). Reduces likelihood of making a mistake when choosing the number. Can't think of a syntax (~ would be great if we had a tag by default, but I think that would be tail/dog).

chrysn commented 10 months ago

Well, it would be ipv4'192.168.0.1' and ipv6'2001:db8::1' (single quotes)

It's nitpicking, but why? Just as a date is a sequence of ASCII characters, so is a human-readable IP address. (Neither allows any values that'd warrant extending to Unicode, but non-Unicode meaningless high bytes would be even weirder in both). Just because the IP address desugars to a byte sequence should have as little impact as the date's desugaring to an integer (no quotes ;-) ) has -- even more so because the IP address may also desugar into an array (ip"2000::/3").

Maybe there should be syntax for evoking a tag (could be used for dt'', too).

DT"2023-01-01" (with tag)? dt+"2023-01-01" (with tag)? dt~"2023-01-01" (without tag, making with-tag the default)? I'm not particularly happy with any of them.

cabo commented 10 months ago

I went for upper case; please check the PR...

As to the "why single quotes"? I'm just saying what the ABNF says at the moment; app-literals are only defined with single quotes.