narrowtux / abacus

Parses and evaluates mathematical expressions in Elixir. Inspired by math.js
MIT License
85 stars 18 forks source link

Eval() function return type for boolean expression #25

Open ChrisRad89 opened 2 years ago

ChrisRad89 commented 2 years ago

This is just a cosmetic thing, but maybe interesting for others...

The dialyzer is complaining about the eval function and a boolean expression. According to the docs, the return type is always a number(), which is not correct in the case of an boolean expression evaluation. There the return value is an atom(), 'true' or 'false'. So is there a way to tell the eval function that we have an boolean return value? Or change the return value in general to any()?

narrowtux commented 2 years ago

probably should change it to any, since it could also be that a value from the scope is returned, which can really be anything.