Comments (3)
@CacheControl makes totally sense. Thank you so much for the answer, it was totally a question not a need of having a synchronous run.
About the syntactic part, I don't think it's a problem, but it could mislead assumptions like rules are ran asynchronously, when the only thing that may be async is getting the facts in case they are dynamic, and the rest of it is completely sync. Plus, obviously the Promise handling that may end up having some impact in performance too.
Again, thanks for taking the time, and anyways I'm open to help in case it's needed.
Have a nice day!
from json-rules-engine.
@ivanetchart Can you help me understand the desire for a synchronous run()? What would that enable?
from json-rules-engine.
Also, to answer your question as to why the promise based interface exists, there are several reasons, primary of which is related to dynamic facts. Although some users of json-rules-engine
will exclusively use constant facts, others have more complex requirements which necessitate loading data on the fly for both performance and practical reasons. Having a single promise based interface for all users allows the engine to support all use cases.
While not having a synchronous run() may be slightly annoying from a syntactic standpoint, having a consistent interface regardless of the way rules and facts are configured is paramount. Finally, asynchronous programming is a core fundamental of the javascript language, and as pointed out in the other issue, language improvements like async
/await
have considerably reduced the cognitive load of asynchronous interfaces; I really don't see it as a major inhibitor.
Glad you're enjoying the library!
from json-rules-engine.
Related Issues (20)
- Adding path values to events HOT 2
- is this project still active HOT 9
- Not able to resolve JsonPath when it includes a where condition HOT 1
- Operator availability - between operator HOT 1
- OnSuccess/OnFailure properties as part of the rule - Security Issue
- Slow performance while having large array of facts. HOT 9
- How to feed engine multiple facts as array! HOT 1
- Complex rule for the fact HOT 2
- woops HOT 1
- Feat: Type-safety using a FactTypeMapping HOT 1
- Is it possible to make sure that a fact triggers at most one rule? HOT 2
- Uncaught TypeError: (0 , _hashIt2.default) is not a function HOT 8
- Error: Cannot find module 'lodash' HOT 1
- problems with the execution of my rules HOT 4
- Example issue - undefined parameter HOT 1
- RuleResult class missing from type declarations HOT 1
- What the best way to launch the rule engine
- Parent child rule
- Ability to stop rules execution after success for array of inputs
- How to create multiple 'aggregate' facts on a 'parent' object calculated from child objects (composition)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-rules-engine.