Extension API
Extensions currently patch core classes directly. This is quite limiting, as cel core types register functions internally, which makes them ractor unsafe until frozen, which means users must freeze cel manually after loading extensions if they want to use it in ractors. It also means core class extensions "leak", and may override each other if patching the same function.
A sketch of what this extension API could look like:
module Cel::Extensions
module String
# ...
module StringMethods
# something of the kind
define_cel_method(:reverse) do
#
end
end
end
end
Cel::Environment.new(extensions: {string: Cel::Extensions::String})