Skip to content
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

strangely long function names.. #113

Open
rcoreilly opened this issue Oct 29, 2018 · 1 comment
Open

strangely long function names.. #113

rcoreilly opened this issue Oct 29, 2018 · 1 comment

Comments

@rcoreilly
Copy link

seems very un-go-like: e.g., NewEvaluableExpression -> NewExpr would be a lot easier to type etc.

anyway, just a comment in case there is a new version released at some point :)

@deanishe
Copy link

That was my first thought, too.

There is no other New* function, so why not just New()?

Personally, I'd rename the types from EvaluableExpression, ExpressionFunction etc. to Expression, Function etc.

And change the import name to eval. eval.New("...") seems much more Go-like:

expression, err := govaluate.NewEvaluableExpression("(requests_made * requests_succeeded / 100) >= 90");

parameters := make(map[string]interface{}, 8)
parameters["requests_made"] = 100;
parameters["requests_succeeded"] = 80;

result, err := expression.Evaluate(parameters);
// result is now set to "false", the bool value.

vs

exp, err := eval.New("(requests_made * requests_succeeded / 100) >= 90");

params := make(map[string]interface{}, 8)
params["requests_made"] = 100;
params["requests_succeeded"] = 80;

r, err := exp.Evaluate(params);
// r is now set to "false", the bool value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants