-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Spec is unclear on function body identifier context #1574
Comments
Yes, thanks for pointing out! There is a composition missing. Please see #1578 for a fix. |
Thank you! #1578 does a good job of clarifying that (contrary to my guess above) the |
Both would work, of course, and I believe your guess was indeed my original intention. But I just figured that the patch in #1578 avoids duplicating the composition. |
Yeah, it’s neater this way — |
As far as I can tell, the text format spec doesn’t explain how a module’s initial identifier context should reach the body of a function definition, which I assume it must somehow.
The$I''$ for the function body by composing $I'$ (synthesised by $I$ containing the module’s initial context is not directly used. But the $I$ : the $I'$ in its synthesised attribute contains only the parameter identifiers. The only syntactic occurrence of $I$ in these productions is when
func
production synthesises an identifier contexttypeuse
) with a context containing the function definition’s local variable identifiers, so the inherited attributetypeuse
production itself also discardstypeuse
looks up the definition of the function’s type.It’s therefore unclear how the remaining contents of$I$ are made available to the function body. The prose accompanying the $I'$ is intended to be formed by extending the inherited attribute $I$ rather than discarding it (e.g. $I' = I \oplus \lbrace \mathsf{locals}~(\epsilon)^n \rbrace$ etc), but that’s just a guess.
typeuse
production does mention “the updated identifier context including possible parameter identifiers” (emphasis mine), which perhaps implies thatHow is this intended to work? Can the spec be updated to clarify?
The text was updated successfully, but these errors were encountered: