You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As stated in #3, there was another way that we could've handled the evaluation that would have allowed us to uncouple from click. I propose that we use that method now with pyparsing as during the parsing step one can give a function for how to handle the parsed portions as they are parsed. This allows us to move away from the messy evaluate function. As it stands currently, it's not pretty to look at. There are parts that have to be deeply couched and the typechecks are worrisome, especially for the functions as the operators are currently mostly x: Union[int, float], y: Union[int, float], but that isn't the case for all and there are nested if-statements to ensure types before it uses them. Still, mypy is unhappy with this set up.
Pros:
Type checking should be happy and the errors that mypy are raising should go away.
This should also end up being cleaner code as lambdas that call each operation specifically should be much easier to grok.
Cons:
Requires a rewrite of a substantial amount of the diceparser, including a lot of filling out for the EvaluationResults class that will need a lot of operation overloading to make everything pretty.
This method I do not believe will be compatible with the new parser that is introduced in 3.10 which we are considering in Change parser to new Structural Pattern Matching Spec #35. This issue should be a year or two in the future however, so new things may come to make this issue moot (hopefully). We cannot be the only ones that would want that type of functionality.
The text was updated successfully, but these errors were encountered:
Could also help facilitate pretty error message printing in issue Pretty error messages for input parsing issues #19 since everything will be verified during parsing which could potentially make the error stack more helpful and we can let pyparsing figure out where in our expression there was an issue.
As stated in #3, there was another way that we could've handled the evaluation that would have allowed us to uncouple from click. I propose that we use that method now with pyparsing as during the parsing step one can give a function for how to handle the parsed portions as they are parsed. This allows us to move away from the messy evaluate function. As it stands currently, it's not pretty to look at. There are parts that have to be deeply couched and the typechecks are worrisome, especially for the functions as the operators are currently mostly
x: Union[int, float], y: Union[int, float]
, but that isn't the case for all and there are nested if-statements to ensure types before it uses them. Still, mypy is unhappy with this set up.Pros:
Cons:
The text was updated successfully, but these errors were encountered: