I think I got most of this, but it’s hard to completely figure out because the 
information is scattered across the grammar.

So, I’m coming up with a statement to copy over a member from one type to 
another:

publish MEMBER-FROM-OTHER-TYPE

and I’m trying to encapsulate this into a grammar. This requires me to figure 
out how to name every single declaration in a type. I got so far:

published-member → decimal-digits
published-member → type-identifier
published-member → identifier | identifier ( argument-names_opt )
published-member → operator | operator (argument-names_opt )
published-member → init | init (argument-names_opt )
published-member → init ? | init ? (argument-names_opt )
published-member → init ! | init ! (argument-names_opt )
published-member → subscript | subscript ( argument-names_opt )

The first line is for tuples, and the rest are for struct/enum/class. The 
second line covers some generics, but I don’t mention generics anywhere else. 
The third line covers properties and functions, while all the following lines 
over functions. There are two branches for those lines to cover all overloads 
sharing a name and to cover a specific overload.

Do I have to mention generic stuff in any of the lines past the second? Are 
there declaration kinds I’m straight-up missing? (Remember that identifier 
covers constants; variables; type-aliases; enumeration cases; inner structure, 
enumeration, class, and extensions; and operator precedence groups.)

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to