Symbols and encouraging symbol-based protocols are a core foundation of this proposal. However:
- implementors raised concerns that this involves a double lookup
- other committee members were concerned about ergonomics since the common case is strings
I wonder if a potential way to make everyone happy might be to support defining protocols as either symbol-first (default) or as literal (concept name TBB). A literal protocol would define strings by default, and there would be additional syntax to define symbols. E.g.:
protocol literal P {
requires foo; // actual string "foo"
requires symbol bar; // P.bar
yolo() {} // provides method "yolo"
symbol quux () {} // provides method P.quux
}
Symbols and encouraging symbol-based protocols are a core foundation of this proposal. However:
I wonder if a potential way to make everyone happy might be to support defining protocols as either symbol-first (default) or as literal (concept name TBB). A literal protocol would define strings by default, and there would be additional syntax to define symbols. E.g.: