-
-
Notifications
You must be signed in to change notification settings - Fork 208
fix: generated function names collision #438
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
fix: generated function names collision #438
Conversation
76ae9f9
to
330acec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason we use real names for functions is to ease debugging. Maybe just add an integer at the end of name?
It will not solve the problem. I can create a field with the same name as another field name + counter. |
I don't know if it's really useful. If you mean useful in the development process, it's pretty clear what this is a function, because you see inlined arguments. If you talking about an error call stack, I would say we should always throw an explainable error and never use a runtime generated call stack to find the reason for the error. But maybe I don't see some useful cases. |
I developed this module by printing out the generated source code, identify which function was causing a problem, and then change the generator. Anonymous functions would prevent this use case, or make it significantly harder. You can achieve the same by adding a comment in the function itself. |
@mcollina What do you think about commenting object properties and their types? // {"b":{"type":"string"},"t":{"type":"object"}}
function anonymous2 (input) {} |
What I need is the "property chain" that lead to that function., what in the original code was |
I will think how to do it clearly. I don't want to pass additional function argument through bunch of core functions to use it in comments in the generated code. |
330acec
to
c828957
Compare
@mcollina I rewrote it. It adds a comment with function name. You can merge it, but I still think that it's overcomplicate the code. |
c828957
to
c7c5ae1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
c7c5ae1
to
805ca68
Compare
Checklist
npm run test
andnpm run benchmark
and the Code of conduct
There is possible to have a function names collision. I suggest not overcomplicating things and using only generated function names.