Comments (2)
From a language perspective, those names are not names of declarations, which is what we'd traditionally allow identifiers to refer to.
That means that while ({int value})
has the identifier value
in there, the identifier doesn't become part of any scope. "Referring" to it is somewhat spurious, since writing the link [value]
doesn't have any scope where [value]
resolves to ... well, anything.
So whatever we do here must be designed from the ground up, the language gives no help.
We could introduce a "documentation scope" which contains the same names as the declaration/parameter scope plus the names of all named record fields.
The biggest question is what happens on a conflict:
- If the record field name has the same name as a parameter, which wins? (The parameter!)
- If the record field name has the same name as the method itself, which wins? (...uhm...)
- If the record field name has the same name as a surrounding top-level declaration or import, which wins? (Possibly the record field... but that's a breaking change of resolution of existing identifiers.)
- If there are two record fields with the same name, which one wins? (Neither!)
Start with:
int foo = 42;
class Foo {
/// Something about [foo].
({int foo}) foo(({String foo, int bar}) foo, (int foo, int bar) v2) =>
(foo: foo.bar);
}
and decide what needs to change before [foo]
can refer to a record field name.
(Today it refers to the positional parameter named foo
, since it's resolved in the parameter scope.)
(It's also a question what it would mean to refer to a record type field name. Will "go to declaration" work? I probably can, if there is a unique resolution. What will be shown when hoovering over the reference?)
from sdk.
Given the ambiguities inherent in the feature, and the limited value that I currently believe it would add for users (in part because of those ambiguities), I'm comfortable saying that we won't implement such a feature at this time.
from sdk.
Related Issues (20)
- [Wildcard Variables] Web debugging support
- vm_service_tester.dart has a wrong uri HOT 1
- Store buffer verification code triggers
- Assert error for aliased constructors in annotations
- Analyzer crashing while processing macro usage HOT 9
- [cfe] Enum named `_` issue
- [CP] Fix `dart run` missing fast path when using Flutter HOT 2
- pkg:json - Support for enums
- pkg:json - Support for dynamic values
- Macros: Declaring a constructor on a generic class with an `implements` breaks generation
- [dart2wasm] Better debugging support HOT 3
- Macros: Expose to `FormalParameter` whether a field is `final` or not. HOT 4
- [Wildcard Variables] VM Debugging Support
- Augmentation libraries: Augmented constructor initializers appear to be ignored.
- DART_VM_OPTIONS for self-executables not working! HOT 6
- Macros: expose `isConst` on `ConstructorDeclaration`
- Enum members do not show up in IDE documentation HOT 1
- Generic function can't be passed as an argument HOT 2
- VM crash in `dart_vm_initializer.cc` from HTTP exception. HOT 1
- dart fix --apply generates duplicate entries for debugFillProperties HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.