Coder Social home page Coder Social logo

Comments (6)

codingseb avatar codingseb commented on July 26, 2024

Yes it's the intended behavior.
I personally use it to modify the behavior of some object when used with ExpressionEvaluator.
But I understand your concern. I could add an option to define the priority between existing Properties/fields/methods and EvaluateVariable and EvaluateFunction events.
What do you think ?

from expressionevaluator.

lholbert avatar lholbert commented on July 26, 2024

It's your baby Seb, but yes, I would agree with that as an option.

Thank you for the quick response and considering optional functionality.

from expressionevaluator.

codingseb avatar codingseb commented on July 26, 2024

In fact for this one, I think I have better idea.
I will add 2 more events that will be fired before evaluation with the possibility to cancel the evaluation of the variable or function. The 2 current events will be evaluate in a second time if no existing variables or functions are found.

Just be aware that using events after all other evaluations will be slower.

from expressionevaluator.

lholbert avatar lholbert commented on July 26, 2024

Sorry didn't see this response.

I think it might have been the actual root of my question, to begin with. Why the variable function was getting called for the property if it did exist (which you answered) ... which was adding some performance overhead that wasn't needed. The proposed solution will essentially be the same overhead as there is now, just reskinned (still that function call to cancel the lookup).

In my mind, the default condition (i.e. the property already exists), should be the quickest path of execution, with no additional overhead needed.

I've looked at several of these libraries, love yours, and will stick with it. Whatever you choose is fine by me. Thanks for your responses!

from expressionevaluator.

codingseb avatar codingseb commented on July 26, 2024

In the begining of ExpressionEvaluator these events were evaluate after all. At some point I changed it to improve the perfs and to redefine some stuff on the fly. The doc about "on the fly" event was written with event evaluated after and I did'nt rewrite it. So it can be confusing.
I think to have the 2 solutions available can be good. I will of course update the doc on the wiki to explain the difference between evaluating before and after.

I think the "after" evaluation can be useful if you don't want to think about eventually conflicts with existing variables and properties. The drawback about perfs just need to be documented.

I will also publish a "breaking change" version to inform of the change so next version will be 1.4.0.0

Thanks for your words. I am happy if this library is useful.

from expressionevaluator.

codingseb avatar codingseb commented on July 26, 2024

OK version 1.4.0.0 resolve this issue. See this for more infos

from expressionevaluator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.