Skip to content

Commit e7e48f7

Browse files
authored
Add first version of a view proposal (#1617)
This is a proposal for adding _views_ to Dart. This is a zero-cost abstraction which has a semantics which is very similar to that of [extension types](https://github.com/dart-lang/language/blob/master/working/1426-extension-types/feature-specification.md), but a different syntax. It represents a further development of the ideas of extension types, and will likely diverge from extension types as it is developed (and extension types are left behind). Here are the main differences at this point: With this proposal, an `extension` declaration does not introduce a type, views and extensions are completely separate constructs. Views come in 3 flavors: open, closed, and plain (declared as `open view ...`, `closed view ...`, and `view ...`), which determines the subtype relationships (open: view type and on-type are mutual subtypes; closed: view type and on-type are unrelated; plain: view type is a supertype of on-type). Views never admit implicit invocations, so the receiver _must_ have the view type in order to invoke any members of a view. Boxing is named explicitly; so there is no `V.class`, but a view can have a clause `box as Name`, and we will then generate a boxing class `Name` or check that an existing class with that name satisfies the requirements.
1 parent f800954 commit e7e48f7

File tree

1 file changed

+965
-0
lines changed

1 file changed

+965
-0
lines changed

0 commit comments

Comments
 (0)