-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Change node access to mathWithTransform
to a map interface
#2264
Conversation
This is really nice 😎 . Less need for Good point about the lazy functionality that is currently in |
Just for clarity: the idea of the "lazy" functions is: the one time creation of the functions takes quite some time, so let's only execute that creation the first the the function is actually invoked. Ideally, when requesting all keys of the map, we get back all the keys, no matter whether they are initialized already or not. |
That How I feel, when I'm working with bootstrapping code. Why don't we land this, then we can think about how best to tackle it. I agree, a |
😂 No problem at all! Let me give this a try to see if this idea of LazyMap indeed works. If so, I'll extend your PR and have this step in one go. If it's more complicated let's merge your PR as-is and refactor |
a0c6a1b
to
22b0282
Compare
It was indeed a tough one to replace I realized this PR (#2264) will introduce a breaking change, so we'll need to publish it as such. There is a feature allowing you to compile/parse/evaluate arguments yourself in a custom, "raw" function, see docs: https://mathjs.org/docs/expressions/customization.html#custom-argument-parsing. This function signature was: rawFunction(args: Node[], math: Object, scope: Object) But now rawFunction(args: Node[], math: Map, scope: Object) I think though that we've already broken this API: right now Let's think through a bit if we can (still) make this backward compatible. And let's think through if we we want to make more related breaking changes (if we're going to break the API anyway let's utilize the opportunity). |
Gotcha, we did see an issue and a suggested documentation fix.
I wonder if adding a node-test which exercises everything in the |
I'm going to close this, due to lost context. Please re-open if you need it. |
👍 thanks for your inputs anyway! We'll look into it again when the need arises. |
As a followup to #2166 (review) this wraps
mathWithTransform
in aObjectWrappingMap
.This explicitly does not attempt to get into the lazy factory/initialization code, which sounds like smarter minds than I are looking at (e.g. #2076 and #1975).
From my run of
tests/benchmark/index.js
this doesn't significantly impact performance.