-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add JS_IsProxy, JS_GetProxyHandler and JS_GetProxyTarget #939
Conversation
This commit also turns JS_IsArray into a simple predicate function. It no longer punches automatically through proxies because that can raise exceptions and is inconsistent with the other predicate functions. Fixes: quickjs-ng#938
Hi @saghul,
Is it a good justification for changing Changes like this make it harder to use the library. Now, the library users had to use not very fun versioning checks. For example, in njs we are trying to work with both quickjs and quickjs-ng. There are already some changes, it is OK. I understand that some changes in API are necessary. But I hope to see less changes without good justification. |
I find the justification to be good. Also, look at the progress, well, the lack thereof, of bellard/quickjs. We won't be beholden to it since no development is going on. Why do you want to support both? There are tons of APIs missing so how do you handle that? |
Could you please elaborate? What do you suggest to do in such a case for current quickjs-ng users? |
We will have to switch to NG eventually, but recent rapid changed in NG are bit scary. It seems we have to wait now, until the code somewhat is settled. Therefore we staying at quickjs for now, but we want to be compatible with NG as well. At least in CI. |
Help me understand. What is scary and what needs to settle? NG has been going on for over a year now and literally every release has been a net improvement over the original IMHO. |
Yes, something like this will work. That is what I called "not very fun versioning checks". Could you please address the original question? |
Aren't you already neck deep in checks since we have a good number of new APIs you might want to use? Even the build system is different 😅 |
Sure. Something like Adding and removing inline caches come to mind.
I am not denying that. My only emphasis is that, while the project is moving in the right direction it will be even more fun for user not to fix the existing code. |
Surprisingly no. So far we have to test only for |
Cohesiveness is important. The old JS_IsArray wasn't. There's one less pitfall to remember now. You're programming against the API. Wouldn't you agree it's better to have fewer exceptions to the rules rather than more? |
Why not change the behavior, but not the signature?
It seems that the following functions can work without ctx too.
Help me understand, how for example, My overall point is: Yes, sometimes changes in API are necessary. But if they are done, they should be done systematically and at once. If there is no clear criteria, probably the change does not improve situation much and is less justified. |
Who says we're done making changes? Except for JS_IsFunction those predicates don't use |
What is the benefit in removing the This also does not stop us from using internal functions that omit the argument are are perfect candidates for compile time or link time inlining. My take is it is probably acceptable for |
Consistency and efficiency. Consistency I've elaborated above. Efficiency: calls to e.g. In isolation maybe not so bad, and LTO can potentially (if not always in actuality) claw back some of that performance loss, but it's one of those death by a 1,000 papercuts things. |
Hi,
Thanks. |
That is what I am talking about. Making changes non-systematically makes it harder for users to use the library. |
That is speculation, isn't it?. Let's start from the question "could we even measure the change with statistical significance". From my experience, memory access pattern is far more significant, than the number of register spills (L1 cache). The later can be even unmeasurable. Meaning ruining just one core struct alignment could negatively impact performance far more. Registers are fast, cache is fast, memory is ~100x slower. |
@hongzhidao If you want the old behavior, use @xeioex It's turning into an uninteresting discussion. Best stop now. |
That is sad to hear that performance question is uninterested one. What I wanted to hear is that the feedback from the users was taken and valid concerns are addressed/admitted. |
This commit also turns JS_IsArray into a simple predicate function. It no longer punches automatically through proxies because that can raise exceptions and is inconsistent with the other predicate functions.
Fixes: #938