Comments (9)
cc @munificent @lrhn
from language.
I'm unable to find other requests for the same thing (which surprises me, except that I can never find anything using GitHub search).
What we are asking for here is a shorter syntax to write a simple class, without having to repeat the field names (or even class name) in a constructor.
from language.
@lrhn perhaps dart-lang/sdk#10551, dart-lang/sdk#10374
from language.
Is there something similar to inline classes in Dart?
from language.
No, we don't have that currently. The main property of an inline class (corresponding to Haskell newtype
) is that it is a zero cost wrapper, in the sense that it is a new type which is distinct from (and not assignable to) the type of the wrapped value, but the run-time representation is just that wrapped value. One example of work in this direction is https://github.com/dart-lang/language/blob/master/working/static%20wrapper%20types/feature-specification.md.
from language.
Thanks @eernstg for the info. Excited for the above feature to be added in Dart.
from language.
Moving this issue to the language repo, it would be a language mechanism.
from language.
Seee #698 – covers your case nicely I think!
from language.
We're tracking this here, closing in favor of that issue (let me know if I've missed something distinct about this request.
from language.
Related Issues (20)
- Destructuring records in functions HOT 5
- Lower the directory depth cost of packages HOT 2
- Can an augmentation library be an entry point? HOT 9
- How do we merge augmentation imports? HOT 6
- Grammar rule adjustments for augmentation libraries HOT 1
- False analyzer warnings when using nullable extensions HOT 2
- Augmentation libraries can't be main libraries as well? HOT 2
- Augmenting declarations cannot occur outside augmentation libraries, right? HOT 4
- Proposal: remove special analyzer behavior for await expressions with "null context". HOT 5
- Proposal: remove special front end behavior for await expressions with context `dynamic`. HOT 2
- Proposal: align front end behavior with analyzer for if-null expressions in context `dynamic`. HOT 3
- Support debugging Dart projects with compilation errors HOT 3
- Pattern matching allows you to refer to its own scope HOT 3
- Proposal: add a context for RHS of equality operations. HOT 1
- matching default values in switch statements (with record patterns) HOT 4
- Failing analysis of macro test prevents other actions HOT 1
- [augmentation-libraries] Missing grammar rule for extension and enum augmentations? HOT 6
- Assignment expressions in `if`-statements don't correctly promote nullable variables HOT 4
- Eliminate symbol literals with several identifiers? HOT 10
- Update the spec parser to take stop and continuation tokens into account for `<typeArguments>` as a selector
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 language.