Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock down brackets #25

Closed
Emoun opened this issue May 25, 2021 · 1 comment
Closed

Lock down brackets #25

Emoun opened this issue May 25, 2021 · 1 comment
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

Comments

@Emoun
Copy link
Owner

Emoun commented May 25, 2021

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.

Syntax Position Bracket Type Example
Substitution [] [ code to be substituted ]
Substitution Parameter List () sub_ident(param1, param2)
Substitution Application Argument [] sub_ident([arg1], [arg2])
Nested Invocation [] #[ .. ][ .. ]
Verbose syntax substitution group [] [sub1 [ .. ] sub2 [ .. ]]
duplicate_inline! invocation [] duplicate_inline!( [ .. ] .. )

Misc:

@Emoun Emoun added D-discussion A decision (D) has not been made yet and is open to discussion I-feature This issue (I) regards a (potential) feature in the project T-accepted Triage (T): Initial review accepted issue/PR as valid labels May 25, 2021
@Emoun Emoun added D-accepted A decision (D) has been made and the issue will be worked on and removed D-discussion A decision (D) has not been made yet and is open to discussion labels May 26, 2021
@Emoun
Copy link
Owner Author

Emoun commented May 26, 2021

Implemented to be released in next version.

@Emoun Emoun closed this as completed May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant