Local function expressions #8734
Unanswered
portal-chan
asked this question in
Language Ideas
Replies: 2 comments
-
The other possible benefit of an IIFE besides recursion is when the local function is transformed into a state machine ( |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Don't know if this was already mentioned/is planned/is secretly a terrible idea but I didn't find anything by searching so here goes:
How about making local functions into expressions so that they could be immediately invoked? Kind of how you're able to do in languages with first class functions:
Before
After
This would allow one-use recursive local functions to be used at the moment of declaration instead of being left at the top/bottom of a function, arguably resulting in some cleaner code. As far as I'm aware there's no notable drawbacks to it unless there's some implementation ones.
Beta Was this translation helpful? Give feedback.
All reactions