-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Combine interfaces with +
or &
#531
Comments
Perhaps TypeScript offers a precedent for |
I find that I prefer using I also think there's a possibility we might want to support a corresponding |
I think this has consensus on |
This isn't urgent, but came up during the meeting today.
Given two interfaces or type-types, say
Printable
andLaunchable
, we want an operator that forms the combination that has the union of the requirements and the types satisfying the result is the intersection of the types satisfyingPrintable
andLaunchable
. There are two choices that are currently under consideration.Plus
Printable + Launchable
:+
.+
operation applied to something frequently in the type position, but whose semantics are very different from the sum operation on types which has more of an "or" flavor (sum types commonly formed using|
in other languages such as Haskell and ML).+
is appropriate may depend on the answer to Is concatenation going to be written+
or something else? #457 re: the operation for string concatenation.Ampersand
Printable & Launchable
:&
is more suggestive of intersection semantics (though this depends on whether your focus is on the requirements or the satisfying types)&
for the "address of" operator and this is unrelated.The text was updated successfully, but these errors were encountered: