expr icon indicating copy to clipboard operation
expr copied to clipboard

how to disable the builtin function "if"

Open emicklei opened this issue 6 months ago • 4 comments

hi,

I am using expr for creating a DSL to program music melodies (melrōse.org) .

The version (v1.17.5) has support for the operator if else but this conflicts with my custom "if" function.

For earlier releases, I was able to disable functions:

for _, each := range []string{"join", "repeat", "trim", "replace", "duration", "map"} {
	options = append(options, expr.DisableBuiltin(each))
}

However, this does not work for the "if" operator. Please advice how to accomplish this.

emicklei avatar Jun 24 '25 20:06 emicklei

Yes, if is an operator. I will add an option to disable if operators.

antonmedv avatar Jun 25 '25 08:06 antonmedv

hi, this bug is blocking my next release. Do you know to which version of expr I can rollback to make it work again?

emicklei avatar Aug 15 '25 16:08 emicklei

One possibility is to use Patcher to check of used if's.

antonmedv avatar Aug 15 '25 17:08 antonmedv

This is not possible as the usage of a custom if function causes the parser to fail

We also have a custom function and are waiting for this feature :) otherwise we cannot upgrade

mambla avatar Oct 08 '25 08:10 mambla