dart-lang / dart-lang/language
Provide canonical way to reference a specific class
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
## The problem
The Dart language doesn't have a way to specify exactly what class one is talking about canonically. This is a minor nuisance when communicating between humans or to an LLM where one must say something like "an instance of Color from 'dart:ui'". However, a lack of consistency when communicating about Dart classes is also an impediment when building semantic understanding in an LLM.
Here is an example of something I've had to request to an LLM:
> okay, now switch the color preview so it isn't drawing a Color object from 'dart:ui', but instead is drawing an Image object from 'dart:ui' that is just a solid color
## Proposal
I propose we make an additional form for `import` to codify a format for communicating about specific classes. I don't think the form has much value to users programmatically, but meta-language-wise it is valuable.
```dart
import 'dart:ui/Color';
import 'package:foo/foo.dart/Foo'
```
These would behave similarly to:
```dart
import 'dart:ui' show Color;
import 'package:foo/foo.dart' show Foo;
```
After this is established I could request to the LLM:
> okay, now switch the color preview so it isn't drawing a 'dart:ui/Color', but instead is drawing a 'dart:ui/Image' that is just a solid color
Contributor guide
Research direction
No files, tests, or entry points are named. Start by reading the proposal and comparing the proposed import forms with existing `show` semantics; this needs a language-design decision on whether the canonical class-reference syntax should be adopted and specified.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100