-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Document iftype
#393
Comments
First mention of iftype for progress toward #393
Looking at the tests on this directive the following clauses are recognized: Standard if:iftype A <: C then
...
end With capability:iftype A <: C box then
...
end Tuple:iftype (A, B) <: (C1, C2) then
...
end Cardinality of tuples must match -- i.e., there is no deduplication via Recursive:iftype A <: T[A] then
...
end Mutually recursive:iftype (A, B) <: (T[B], T[A]) then
...
end Nested:iftype A <: T then
iftype A <: C then
...
end
end Replace type args:iftype X <: A #read then
...
end |
My opinion on where this might best fit in the tutorial currently is Equality in Pony in a section called "Type Equality" or something similar. Forewarning: "the subtype in an iftype condition must be a type parameter or a tuple of type parameters" so the following does not pass the compiler: primitive P
type T is P
actor Main
new create(env: Env) =>
iftype T <: P then
None
end nor does replace the iftype expression with |
Also important to note that |
It's been around for a long time as a "beta" sort of feature. It's required for some programs. At this point, I think we need to document it so that general users can access, use, and push our understanding of its shortcomings.
The text was updated successfully, but these errors were encountered: