-
Notifications
You must be signed in to change notification settings - Fork 13
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
Why is the argument of a cont_type a heap_type #106
Comments
For one, because this avoids duplication: for most cont types of shape t1* → t2*, in practice you'll typically need function types of the same shape somewhere. This way, they can reuse the same definition. Secondly, because there are in fact typing rules that need to form that sister function type from a given cont type, e.g., the typing rule for cont.new. If we couldn't simply extract a type index for it from the definition, then we'd generally need to synthesise auxiliary type definitions during validation, which would be gnarly — especially once recursive function types enter the picture, for which there wouldn't even be a uniquely determined rolled type to introduce. In the given formulation, the choice is fully determined by the definition of the cont type. Malformed types or incorrect uses of type indices can occur in many other places (e.g., a function definition's type index not referring to a function type), so that isn't anything special. |
Should we not have some validation rules? E.g., a cont_type is only valid if its argument is an index type of a func_type definition? |
ok. got it. |
Reopening, because the current design introduces an 'annoyance': |
Perhaps we can require that the function type is defined before the continuation type, similar to how we require that supertypes are defined before their subtypes, so their structure is already available to validate. |
That is a valid point. But of course, everything is a trade-off. The alternative of synthesising new type definitions during validation would be much worse in most implementations. One hack to avoid the extra pass in this instance could be to restrict Having said that, don't you need an extra pass for checking |
Restricting cont types to acyclic will not work: if you use switching, then nearly every continuation will have a recursive type. |
@fgmccabe, the idea is that only the edge from the cont type to its func type would have to go backwards, so you could still write this mutual recursion:
|
(But this should be moot due to the existing need for two passes that @rossberg mentioned.) |
Continuing (sic) my complaint: in V8, validating subtype correctness is a separate path in the validator. It is not exercised in cases not involving subtypes. |
In the proposed spec interpreter, we have:
...
My question is: why is cont_type defined this way. This syntactically permits invalid forms of continuation types. Why isn't it the same as a func_type:
The text was updated successfully, but these errors were encountered: