Closed lann closed 10 months ago
Additional options:
|read, write|
. (I know that looks like a closure in Rust/Ruby/etc., but I guess in context it'll be fine.){_}
as "record without explicit fields", and parse {}
as flags.Another option: {:}
as "record without explicit fields", which would lead to the nice property that records always contain a :
between braces.
Yet another option: require that empty flag sets be expressed as ∅
:smile:
{:}
for "empty" records.
An "empty set" value
{}
has two possible interpretations: aflags
value with zero flags set or arecord
value with all field values set tonone
(because "Record entries with the option-typed value none may be omitted").The WAVE parser in this repo avoids this ambiguity because it is type-driven, but any alternative implementation that wanted to parse to an AST would need to address it.
I see two obvious options:
{}
for records. Arecord
with all fields values set tonone
would need to specify at least one of those fields explicitly, e.g.{optional-field: none}
{}
its own formal rule (e.g.empty-set := '{' '}'
) and accept the AST ambiguity. AST ambiguity is already present for other Component Model value representations such as various number types andbool
s (vs variant case labels).