Skip to content
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

Interference with mutual recursion #3

Open
ByteEater-pl opened this issue Apr 4, 2024 · 1 comment
Open

Interference with mutual recursion #3

ByteEater-pl opened this issue Apr 4, 2024 · 1 comment

Comments

@ByteEater-pl
Copy link

What if decorated functions f and g need to call each other? A problem arises if f is defined, g still isn't, yet f calls (directly or not) g. And they cannot be reordered because g calls f too and the problem would be the same with roles reversed. Without decorators there's hoisting, so no problem.

It seems that a sufficient solution, and possibly a piece of advice to include in educational materials, is for authors to define sets of (2, as above, or even more) mutually recursive decorated functions without any code that runs between their definitions which could call one already defined, inside of which a call to some still undefined "function" would be executed.

WDYT? It seems not to have been discussed at the February meeting, so I'm bringing it to your attention.

@BalaM314
Copy link

Agreed, I think the best solution to this is to put all decorated function declarations before any code that uses them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants