As of #664, the syntax for enumerators with associated fields looks like:
enum E {
Foo(b: bool)
}
Should we switch to use braces instead:
enum E {
Foo { b: bool }
Bar {
d: Dictionary<string, ::WellKnownTypes::SomeLongName>
tag(12) bool?
tag(13) ::MyApplication::MySliceType
}
}
1) Braces are consistent with structs, classes, etc. You know, all the other things that contain fields.
Whereas parenthesis are only used for operations. Since these are associated fields and not associated parameters,
using braces would be slightly more logical I think.
2) It's consistent with Rust's syntax. There are 2 syntaxes for enumerators: tuple-like syntax and struct-like syntax.
-Tuple like syntax doesn't use identifiers, it's a tuple of types: (bool, string, Foo).
-Struct like syntax does use identifiers, and is written like a struct: { b: bool, s: string, f: Foo }
Note that Swift uses parenthesis, although from my (not extensive) googling, tuple syntax seems much more common in Swift than it does in Rust.
3) It's more common to put spaces around braces; usually you don't put spaces around parenthesis.
I think the extra space improves readability.
As of #664, the syntax for enumerators with associated fields looks like:
Should we switch to use braces instead:
1) Braces are consistent with structs, classes, etc. You know, all the other things that contain fields. Whereas parenthesis are only used for operations. Since these are associated fields and not associated parameters, using braces would be slightly more logical I think.
2) It's consistent with Rust's syntax. There are 2 syntaxes for enumerators: tuple-like syntax and struct-like syntax. -Tuple like syntax doesn't use identifiers, it's a tuple of types:
(bool, string, Foo)
. -Struct like syntax does use identifiers, and is written like a struct:{ b: bool, s: string, f: Foo }
Note that Swift uses parenthesis, although from my (not extensive) googling, tuple syntax seems much more common in Swift than it does in Rust.3) It's more common to put spaces around braces; usually you don't put spaces around parenthesis. I think the extra space improves readability.