Skip to content

RFC: Function Calls with Named Arguments #135

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

matlneus
Copy link

Rendered

This RFC proposes adding optional named arguments to Luau function calls, allowing arguments to be specified by parameter name rather than position.

(I liked @Wunder-Wulfe's idea in #91 (comment))

@jackdotink
Copy link
Contributor

I do not think it is possible to implement this into the VM in any way that is actually any good. It will always be equivalent to or worse than passing a table, so you should probably just pass a table.

@matlneus
Copy link
Author

matlneus commented Aug 24, 2025

I do not think it is possible to implement this into the VM in any way that is actually any good. It will always be equivalent to or worse than passing a table, so you should probably just pass a table.

I don't think any changes need to be made to the VM for the idea this RFC proposes, because at least for now, named arguments would be resolved at compile-time, not at run-time.

Also, I don't really see how it'd be worse than a table. It could be equivalent if it were just syntax sugar for table arguments, but I don't see how it could be worse. I'm inclined to believe that creating tables in loops or hot paths would lead to bad performance, but this could be benchmarked.

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

Successfully merging this pull request may close these issues.

2 participants