Skip to content

Commit a9ed2a3

Browse files
authored
Revise the views feature specification substantially (#2443)
This PR uses recent ideas (from the extension struct proposal and several other sources) to create a substantially revised version of the views proposal. In particular: - Views no longer have an implements clause. - Views no longer support boxing. - Views allow for the use of a 'primary constructor' (a parenthesized list occurring right after the name and type parameters). Hence, the "wrapped" object is denoted by the name declared in this constructor, and this has the enclosing view as its type. - Views use an export declaration in the body rather than a show/hide clause in the header to provide access to members of the underlying representation type. - Views come in only two variants: Plain ones where the representation type and the view type are unrelated, and implicit ones where the representation type is a subtype of the view type. - Views are enhanced with a new mechanism known as 'view extensions'. A view extension declaration allows for adding members to a view, in a manner which is much like that of a regular extension methods, but the added members are "sticky" (which means that they are available on any expression whose type is the view type, even in the case where the import path to the view extension declaration has more than one edge).
1 parent 94028f3 commit a9ed2a3

File tree

1 file changed

+982
-531
lines changed

1 file changed

+982
-531
lines changed

0 commit comments

Comments
 (0)