-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add anonymous functions (lambdas) support #32
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
Conversation
…eted and add new addition example
…ction calls and undefined variables in lambda bodies
…cluding syntax and use cases
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Add support for anonymous function expressions (lambdas) that can be assigned to variables and called dynamically.
Changes
parser.c/h) with new AST node typesOP_CREATE_FUNCTIONandOP_INVOKE_FUNCTION(compiler.c/h)vm.c/h)owned_bytecodefield for proper lambda memory managementvalue_new_functionto support parameter names (runtime.c/h)Testing
tests/integration/pass/lambda_basic.kr- basic lambda assignment and callstests/integration/pass/lambda_multiline.kr- multi-line lambdas with block bodiesDocumentation
website/content/docs/language/functions.mdx- lambda syntax and use caseswebsite/content/docs/quick-reference.mdx- quick reference entrywebsite/content/docs/roadmap.mdx- marked as completedBreaking Changes
None