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

Improve dev UX with proper function arglists #4

Merged
merged 3 commits into from
Aug 28, 2019
Merged

Conversation

dhleong
Copy link
Owner

@dhleong dhleong commented Aug 28, 2019

As mentioned in the comments, we don't seem to be able to generate good arglists if your factory has variadic args, but I suspect this is an uncommon case. In the common case of a simple args vector we can use the original vector directly, which reduces the amount of code generated; and in the less-common case where destructuring is used for a fixed number of args we can still generate a nice :arglists meta that hides the implementation details.

Fixes #2

For the common case, this produces smaller, more efficient javascript,
and also automatically gives us a useful arglist in the function docs.
However, it won't work if there's any destructuring in the params
vector.
This certainly adds some complexity, but since it's all handled
at compile time, so there's no overhead at runtime. It also means
that in the general cases you can get better experiences, but we
still support the fancy case if anybody wants to do that.
@dhleong dhleong merged commit 43da869 into master Aug 28, 2019
@dhleong dhleong deleted the dhleong/arglist branch August 28, 2019 17:49
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.

Generate appropriate arglist meta for functions
1 participant