SymbolicML / DynamicExpressions.jl

Ridiculously fast symbolic expressions
https://symbolicml.org/DynamicExpressions.jl/dev
Apache License 2.0
103 stars 15 forks source link

By default, throw errors from `MethodError` #5

Closed MilesCranmer closed 1 year ago

MilesCranmer commented 1 year ago

Right now, in eval_tree_array(::Node, ::AbstractArray, ::GenericOperatorEnum), MethodErrors are caught before they occur, and nothing is returned. This is faster, but may not be what a user expects.

This introduces a new keyword argument throw_error to eval_tree_array (only the generic version) which can be turned on (default) to throw MethodErrors, or off, to cleanly catch them and return nothing. In practice, it can be faster to simply return early, rather than to throw and catch an error.