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

refactor!: rename .arguments to .$args for functions #7

Merged
merged 3 commits into from
Feb 16, 2023

Conversation

antfu
Copy link
Member

@antfu antfu commented Feb 15, 2023

When we write exports.default.arguments[0].foo = 'bar', it can be a bit ambiguous to tell wether arguments is from us, or it's a real property. I think it could be better to have more explicit utils prefixed with $

@antfu antfu requested a review from pi0 February 15, 2023 14:06
@pi0
Copy link
Member

pi0 commented Feb 15, 2023

Indeed magic keys via proxy on top level can always make this ambiguousness and we are exposing some non $ prefixed ones. But i expect we always have to check $type before operating on one key. In what situation do you think for type of function-call it can be problematic?

@pi0 pi0 changed the title feat!: explicit naming of function utils refactor!: rename .arguments to .$args for functions Feb 15, 2023
@antfu
Copy link
Member Author

antfu commented Feb 15, 2023

Yeah it shouldn't be a big problem. What I am thinking is that we could keep the syntax close as runtime as possible. While the function call is a new thing we introduced on top of the runtime, so it could be better to distinguish them.

@pi0
Copy link
Member

pi0 commented Feb 15, 2023

Makes sense. BTW i guess we had to call it .$params o .$parameters as function calling params :D Wdyt?

@antfu
Copy link
Member Author

antfu commented Feb 15, 2023

I am ok with both. But checking the docs https://developer.mozilla.org/en-US/docs/Glossary/Parameter and https://en.wikipedia.org/wiki/Parameter_(computer_programming) - it looks like arguments make a better fit for function calls? parameters should be used in the function declaration.

@pi0 pi0 merged commit 446f7ed into main Feb 16, 2023
@pi0 pi0 deleted the feat/explict-function-info branch February 16, 2023 11:07
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

Successfully merging this pull request may close these issues.

2 participants