Skip to content

Commit b101f5c

Browse files
committed
Add alternatives, future possibility from feedback
1 parent ce7c5ac commit b101f5c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

text/3323-restrictions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ Trait aliases cannot be implemented. As such, there is no concern about compatib
390390
they would be with the proposed syntax. It would also mean macro authors would be unable to accept
391391
only syntax that would be valid in a given context. Further, some positions such as `enum`
392392
variants do not semantically accept a visibility, while they do accept a restriction.
393+
- The current syntax separates the `mut`/`impl` keyword from the scope of the restriction. This
394+
produces verbose syntax. Many users may want similar restrictions. Could we provide a simpler
395+
syntax if we provided less flexibility? Would a new keyword or two help? We could choose a syntax
396+
with less flexibility and verbosity but more simplicity. For instance, `sealed` or `readonly`.
393397

394398
# Prior art
395399

@@ -444,6 +448,8 @@ Trait aliases cannot be implemented. As such, there is no concern about compatib
444448
- Should `struct` expressions be disallowed?
445449
- Where would it be desirable to prohibit mutability after construction, but still permit
446450
construction with unchecked values?
451+
- Should a simpler syntax be provided for common cases? For instance, `sealed` or `readonly`. A
452+
different syntax altogether could be used as well.
447453

448454
# Future possibilities
449455

@@ -463,3 +469,4 @@ Trait aliases cannot be implemented. As such, there is no concern about compatib
463469
identical to omitting the keyword entirely.
464470
- `mut` could be placed on the `struct` or variant itself, which would be equivalent to having the
465471
same restriction on each field. This would avoid repetition.
472+
- Trait implementations could be restricted to being used within a certain scope.

0 commit comments

Comments
 (0)