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

Should classes be nominally or structurally typed? #4

Open
samuelgoto opened this issue Jul 11, 2017 · 1 comment
Open

Should classes be nominally or structurally typed? #4

samuelgoto opened this issue Jul 11, 2017 · 1 comment

Comments

@samuelgoto
Copy link
Owner

(porting comments from an early review from @domenic to github issues)

@domenic: JS is generally structurally typed, so introducing nominal typing sounds awkward.

TODO(@goto, @dimvar): write this up.

@erights: is this (nominal typing) closer to the semantics of the runtime checks, like instanceof?

@erights
Copy link

erights commented Jul 11, 2017

instanceof is definitely a nominal-like test, not a structural-like one.

Btw, somewhere I heard the following hilarious observation:

Nominal types are about class names. Structural types are about method names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants