Skip to content

Commit 8d81eec

Browse files
munificenteernstg
andauthored
[class mods] Fix grammar to prohibit "mixin" on mixin applications. (#2847)
* [class mods] Fix grammar to prohibit "mixin" on mixin applications. It looks like the prose (which I think is correct) got out of sync with the grammar. This fixes that. I also tweaked the Markdown formatting a bit because I'm a little obsessive. I'm sorry. * Update accepted/future-releases/class-modifiers/feature-specification.md Co-authored-by: Erik Ernst <[email protected]> * Update accepted/future-releases/class-modifiers/feature-specification.md Co-authored-by: Erik Ernst <[email protected]> * Wrap logically. --------- Co-authored-by: Erik Ernst <[email protected]>
1 parent 25e42d5 commit 8d81eec

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

accepted/future-releases/class-modifiers/feature-specification.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Author: Bob Nystrom, Lasse Nielsen
44

55
Status: Accepted
66

7-
Version 1.4
7+
Version 1.5
88

99
Experiment flag: class-modifiers
1010

@@ -523,10 +523,10 @@ Many combinations don't make sense:
523523
A `sealed mixin class` does not provide any significant extra
524524
functionality over a `sealed mixin`, you can replace `extends MixinClass`
525525
with `with Mixin`, so a `sealed mixin class` is not allowed.*
526-
* `interface` and `final` classes would prevent a mixin class from being used as a
527-
superclass or mixin outside of its library. _Like for `sealed`, an `interface` or `final`
528-
`mixin class` is not allowed, and an `interface` or `final` `mixin` declaration is
529-
recommended instead._
526+
* `interface` and `final` classes would prevent a mixin class from being used
527+
as a superclass or mixin outside of its library. *Like for `sealed`, an
528+
`interface mixin class` and `final mixin class` are not allowed, and
529+
`interface mixin` and `final mixin` declaration are recommended instead.*
530530
* `mixin` as a modifier can obviously only be applied to a `class`
531531
declaration, which makes it also a `mixin` declaration.
532532
* `mixin` as a modifier cannot be applied to a mixin-application `class`
@@ -560,16 +560,17 @@ The remaining valid combinations and their capabilities are:
560560
The grammar is:
561561

562562
```
563-
classDeclaration ::= classModifiers 'class' identifier typeParameters?
564-
superclass? interfaces?
563+
classDeclaration ::= (classModifiers | mixinClassModifiers) 'class' typeIdentifier
564+
typeParameters? superclass? interfaces?
565565
'{' (metadata classMemberDeclaration)* '}'
566566
| classModifiers 'class' mixinApplicationClass
567567
568568
classModifiers ::= 'sealed'
569569
| 'abstract'? ('base' | 'interface' | 'final')?
570-
| 'abstract'? 'base'? 'mixin'
571570
572-
mixinDeclaration ::= mixinModifier? 'mixin' identifier typeParameters?
571+
mixinClassModifiers ::= 'abstract'? 'base'? 'mixin'
572+
573+
mixinDeclaration ::= mixinModifier? 'mixin' typeIdentifier typeParameters?
573574
('on' typeNotVoidList)? interfaces?
574575
'{' (metadata classMemberDeclaration)* '}'
575576
@@ -770,7 +771,8 @@ Define a *trivial generative constructor* to be a generative constructor that:
770771
771772
* declares no parameters,
772773
773-
* has no initializer list (no `: ...` part, so no asserts or initializers, and no super constructor invocation),
774+
* has no initializer list (no `: ...` part, so no asserts or initializers, and
775+
no super constructor invocation),
774776
775777
* has no body (only `;`), and
776778
@@ -933,6 +935,11 @@ needed.
933935

934936
## Changelog
935937

938+
1.5
939+
940+
- Fix mixin application grammar to match prose where `mixin` can't be applied
941+
to a mixin application class.
942+
936943
1.4
937944

938945
- Update rules to close loopholes on classes that don't want to expose

0 commit comments

Comments
 (0)