Lock down brackets #25
Labels
D-accepted
A decision (D) has been made and the issue will be worked on
I-feature
This issue (I) regards a (potential) feature in the project
T-accepted
Triage (T): Initial review accepted issue/PR as valid
Short Description:
Change the syntax to lock down which bracket types are allowed in various syntactic positions.
Motivation:
The current syntax doesn't distinguish between bracket types anywhere. This was meant to allow users to choose their preferred brackets in various positions.
After doing a survey of project on Github using
duplicate
, it seems no one makes use of the bracket flexibility. They all simply seem to follow the examples of the documentation.The flexibility does have its downsides. First, it makes future updates to the crate harder (see e.g. #23). Second, it allows fragmentation in syntax, where some code bases might use one set of brackets in a given position and another code bases could use another set of brackets in the same position. This makes it more difficult to parse for users. It also makes it more difficult for people without knowledge of this crate to figure out if the given set of brackets means anything special (which it doesn't current, which is counterintuitive).
Design
We define a specific bracket type for each position in the syntax. We will use the brackets as they are currently used in the documentation examples. This means even though the change is technically breaking, most users wont notice, as they are already using the right brackets.
[]
[ code to be substituted ]
()
sub_ident(param1, param2)
[]
sub_ident([arg1], [arg2])
[]
#[ .. ][ .. ]
[]
[sub1 [ .. ] sub2 [ .. ]]
duplicate_inline!
invocation[]
duplicate_inline!( [ .. ] .. )
Misc:
The text was updated successfully, but these errors were encountered: