dart-lang / dart-lang/language
Should the use of both show and hide on an import be a syntax error?
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
In this example `hide` adds no meaning because if an identifier is not in the list of `show` it is not visible anyway:
```dart
import 'package:collection/collection.dart' show ListEquality hide MapEquality;
void main() {
ListEquality();
//MapEquality(); // undefined
}
```
Moreover an identifier can be in both `show` and `hide` resulting in it being hidden:
```dart
import 'package:collection/collection.dart' show ListEquality hide ListEquality; // ignore: unused_import
void main() {
//ListEquality(); // undefined
}
```
Both of these examples build and produce no linter issues.
Is there a valid case for using both `show` and `hide` on a single import? If yes, then there should be a lint that flags the meaningless cases like above. If no, should this be a syntax error? With Dart 3 allowed to introduce breaking changes, should this opportunity be used to add this syntax change?
Contributor guide
Research direction
Start with the two import examples in the issue and review the language-design discussion about combining show and hide. Determine whether the behavior should become a syntax error or a lint, and document the accepted rule and its effect on both examples as the completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100