gavinhoward/bc

Allowing redefinition of builtin function such as abs() for compatibility with bc scripts

Closed this issue · 2 comments

First I'd like to thank you for the work and care in making bc.

I replaced GNU bc with your bc on my system, and ran into a error trying to run bc with some external bc libraries that define functions such as abs()

This is because your bc already has a built in abs(), and unlike the functions in the -l math library, will not let you redefine it because it appear to not just be a function, but also a lexer tokens/keyword.

Is this a problem that you've ran into or considered before?

Yup! And my bc already has a solution:

$ bc -r abs <other_args...>

See here, scroll to the -r/--redefine option.

In short, it allows you to "redefine" keywords as functions, variables, or arrays.

Of course, if that doesn't fix your problem, then it is a bug.

Putting -r abs in my function arguments will run the library.

Thank you for your help