Hi Frank,
many thanks for your feedback, it is greatly appreciated. I am sorry for
late reply. Also, I am CCing the list.
> ## Enum value uniqueness
>
> See: https://www.ietf.org/archive/id/draft-devault-bare-07.html#name-invariants
>
> The specification says:
>
> > Enums MUST have at least one named value, and each named value of an
> > enum MUST be unique.
>
> Does this mean that only the value names need to be unique? I'm
> guessing the values themselves also need to be unique.
The specification says about "named value" that is (from ABNF):
enum-value = enum-value-name [[WS] "=" [WS] integer]
so "named value" is an (optional, automatically incremented) integer
that is aliased by a name. It is unfortunate that it can be easily
confused with "value name", which is something different, but I am not
sure how to word it better. I hope it is clearer?
> ## Uniqueness of types in unions
>
> See: https://www.ietf.org/archive/id/draft-devault-bare-07.html#name-invariants
>
> The specification says:
>
> > Unions MUST have at least one type, and each type of a union MUST be
> > unique.
>
> Wouldn't it be ok to have non-unique types and unique numeric
> identifiers?
Use-case with non-unique types is possible with user-defined types. The
requirement for the uniqueness is in the specification since version 00.
I think it is related to backwards- and forwards-compatible messages and
good naming practices, but I am not completely sure.
> ## any-type grammar
>
> See: https://www.ietf.org/archive/id/draft-devault-bare-07.html#name-abnf-grammar
>
> The grammar of `any-type` does not allow for user type names. Example: `type x otherx`
True, this should be possible. I will update ABNF as the following:
schema = [WS] user-types [WS]
user-types = user-type [WS user-types]
user-type = "type" WS user-type-name WS any-type
user-type-name = UPPER *(ALPHA / DIGIT) ; first letter is uppercase
any-type = "uint" / "u8" / "u16" / "u32" / "u64"
any-type =/ "int" / "i8" / "i16" / "i32" / "i64"
any-type =/ "f32" / "f64"
any-type =/ "bool"
any-type =/ "str"
any-type =/ "data" [length]
any-type =/ "void"
any-type =/ "enum" [WS] "{" [WS] enum-values [WS] "}"
any-type =/ "optional" type
any-type =/ "list" type [length]
any-type =/ "map" type type
any-type =/ "union" [WS] "{" [[WS] "|"] [WS] union-members [WS] ["|" [WS]] "}"
any-type =/ "struct" [WS] "{" [WS] struct-fields [WS] "}"
any-type =/ user-type-name
length = [WS] "[" [WS] integer [WS] "]"
integer = 1*DIGIT
enum-values = enum-value [WS enum-values]
enum-value = enum-value-name [[WS] "=" [WS] integer]
enum-value-name = UPPER *(UPPER / DIGIT / "_")
type = [WS] "<" [WS] any-type [WS] ">"
union-members = union-member [[WS] "|" [WS] union-members]
union-member = any-type [[WS] "=" [WS] integer]
struct-fields = struct-field [WS struct-fields]
struct-field = 1*ALPHA [WS] ":" [WS] any-type
UPPER = %x41-5A ; uppercase ASCII letters, i.e. A-Z
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
WS = 1*(%x0A / %x09 / " ") ; whitespace
Thank you and have a nice day,
jiri
---
I am sorry I let the BARE specification expired again. I hoped to
restore the work on the specification sooner, but things get complicated
all the time. Hopefuly, I will be able to make the updates before the
end of the year. Thanks for the patience.
>> ## Enum value uniqueness
> I hope it is clearer?
Yes, thanks. I guess I read it the wrong way. :)
>> ## Uniqueness of types in unions
> Use-case with non-unique types is possible with user-defined types. The
> requirement for the uniqueness is in the specification since version 00.
> I think it is related to backwards- and forwards-compatible messages and
> good naming practices, but I am not completely sure.
Seems reasonable.
>> ## any-type grammar
> I will update ABNF as the following…
Thanks.
> I am sorry I let the BARE specification expired again. I hoped to
> restore the work on the specification sooner, but things get complicated
> all the time. Hopefuly, I will be able to make the updates before the
> end of the year. Thanks for the patience.
No problem. Take you time.
Thanks,
Frank