You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deff():
returng() # g has not been defined yet during parsingdefg():
return1
This is not a problem as long as the parser is called after the definition of g. To support forward references in general (e.g. in an @myia decorator) we have to postpone name resolution until after the entire scope has been parsed.
For local forward references we have to actually separate the name resolution from the parsing i.e. h should remain unresolved while parsing g under the assumption that it is a forward declaration (and then be resolved to h when we come across it). Note that this is related to #11 i.e. if we perform name resolution statically we need to ensure that there is only one name declaration corresponding to the forward reference (otherwise we need to do it dynamically by introducing environments).
deff():
defg():
returnh()
defh():
returng()
The text was updated successfully, but these errors were encountered:
Python allows for forward references.
This is not a problem as long as the parser is called after the definition of
g
. To support forward references in general (e.g. in an@myia
decorator) we have to postpone name resolution until after the entire scope has been parsed.For local forward references we have to actually separate the name resolution from the parsing i.e.
h
should remain unresolved while parsingg
under the assumption that it is a forward declaration (and then be resolved toh
when we come across it). Note that this is related to #11 i.e. if we perform name resolution statically we need to ensure that there is only one name declaration corresponding to the forward reference (otherwise we need to do it dynamically by introducing environments).The text was updated successfully, but these errors were encountered: