Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support anonymous subtypes #1728

Closed
dsaf opened this issue Apr 1, 2015 · 3 comments
Closed

Support anonymous subtypes #1728

dsaf opened this issue Apr 1, 2015 · 3 comments
Assignees
Labels
Area-Language Design Feature Request Resolution-Duplicate The described behavior is tracked in another issue Verified

Comments

@dsaf
Copy link

dsaf commented Apr 1, 2015

Syntax can be very similar to #13 but I think it should be extended to subtyping other classes as well.

Aside from general usefulness it will prevent potential interface overuse that could happen if only interfaces are supported via #13. I tend to use both interfaces and abstract classes depending on "A is B" vs "A supports B" semantic choices rather than making everything an interface "because DI".

http://www.jot.fm/issues/issue_2005_07/article1.pdf

Note that as generalizations, interfaces compete with abstract classes. In fact, in
practice interfaces and abstract classes are sometimes used as if they were the same
concept. However, since abstract classes have the potential to pass on implementation to
their subclasses, they should be used if (and only if) the relationship to the subclasses is
genetic, i.e., if it is (or at least could be) based on the inheritance of internal structure, that
is, implementation. If on the other hand the relationship is based on pure function (or,
weaker still, on sameness of protocol), interfaces should be used. For instance, a linked
list and a dynamic array would normally not be genetically related (i.e., have no common
pieces of implementation), yet they share the interface of lists (specifying sequential
access to their elements).

I think Java supports this as "anonymous classes".

@dsaf dsaf changed the title [Area-Language Design] Support anonymous type implementations and subtypes [Area-Language Design] Support anonymous interface implementations and subtypes Apr 1, 2015
@dsaf dsaf changed the title [Area-Language Design] Support anonymous interface implementations and subtypes [Area-Language Design][Discussion] Support anonymous interface implementations and subtypes? Apr 1, 2015
@svick
Copy link
Contributor

svick commented Apr 1, 2015

This seems to be a duplicate of #13, only with different (and IMO worse) syntax.

@dsaf
Copy link
Author

dsaf commented Apr 1, 2015

Actually the syntax was very similar, but yeah it was a half-duplicate.

@dsaf dsaf closed this as completed Apr 1, 2015
@dsaf dsaf reopened this Apr 1, 2015
@dsaf dsaf changed the title [Area-Language Design][Discussion] Support anonymous interface implementations and subtypes? [Area-Language Design][Discussion] Support anonymous subtypes Apr 1, 2015
@dsaf dsaf changed the title [Area-Language Design][Discussion] Support anonymous subtypes [Area-Language Design] Support anonymous subtypes Apr 1, 2015
@dsaf dsaf changed the title [Area-Language Design] Support anonymous subtypes [Area-Language Design][Feature Request] Support anonymous subtypes Apr 1, 2015
@Pilchie Pilchie changed the title [Area-Language Design][Feature Request] Support anonymous subtypes Support anonymous subtypes Apr 1, 2015
@gafter
Copy link
Member

gafter commented Apr 14, 2015

Closing as a dup of #13.

Noted that @dsaf would like it extended to other types as well.

@gafter gafter closed this as completed Apr 14, 2015
@gafter gafter added the Resolution-Duplicate The described behavior is tracked in another issue label Apr 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Language Design Feature Request Resolution-Duplicate The described behavior is tracked in another issue Verified
Projects
None yet
Development

No branches or pull requests

6 participants