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

Structural types #21984

Closed
DartBot opened this issue Jan 2, 2015 · 3 comments
Closed

Structural types #21984

DartBot opened this issue Jan 2, 2015 · 3 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jan 2, 2015

This issue was originally filed by [email protected]


What would you like to see instead?

I really like the idea of Go interfaces. (Classes do not have to declare what interfaces they support. An interface is a set of methods. Any class that has those methods implements the interface.)

A lot of type checking in Dart is done at runtime anyways. It would be nice if a language user could take an advantage of it. The type system could allow expressing properties that are not nominal and static, but more like structural runtime asserts.

Please provide any additional information below.

Using an example given by Miško Hevry in https://www.youtube.com/watch?v=lGdnh8QSPPk while introducing AtScript [1] @­15:00, I'd like to declare a type CssSelector which would be satisfied by anything of type String if the string matches a given Regexp.

Even though those properties are not static, an IDE could still take some limited advantage of it for code completion, during debugging and so on.

Related issue "Is the Dart type system is nominal?" #­7639

[1] https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit97HnZoKVygDxpWzEYW0U/edit

@lrhn
Copy link
Member

lrhn commented Jan 2, 2015

Added Area-Language, Triaged labels.

@gbracha
Copy link
Contributor

gbracha commented Jan 2, 2015

We are not about to do major surgery on the Dart type system. It's mostly nominal, with the usual structural exceptions around functions and generics.


Set owner to @gbracha.
Added NotPlanned label.

@DartBot
Copy link
Author

DartBot commented Jan 2, 2015

This comment was originally written by [email protected]


I just found this request is somewhat similar to Issue #3049 "Contracts". If we get that instead, I'd be happy too.

@DartBot DartBot added Type-Enhancement area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue labels Jan 2, 2015
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants