Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feature: Late Bind Function Calls at Evaluation Time#1172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
hyp0th3rmi4 wants to merge23 commits intogoogle:master
base:master
Choose a base branch
Loading
fromhyp0th3rmi4:featute/function-late-bind-eval

Conversation

@hyp0th3rmi4
Copy link

@hyp0th3rmi4hyp0th3rmi4 commentedApr 27, 2025
edited
Loading

Pull Requests Guidelines

This PR provides a minimal but fully functional prototype implementation for Late-binding functions at program evaluation time. It supports the discussion originated in:#1081, to demonstrate that it can be done.

The implementation comes fully tested in the new code that has been added, which has been kept at minimum, by trying to limit changes in the code base.

The model usesfunctions.Overload as the primary abstraction to supply run-time implementations of functions to replace the same overloads bound to the call nodes during tree parsing and checking.

Files Changed:

  • interpreter/activation.go: added a new interface LateBindActivation with ability to resolve overloads given an overload identifier.
  • intepreter/decorators.go: added the implementation of an InterpretableDecorator that manipulate call evalXXX nodes to defer the function bind at evaluation time.
  • intepreter/interpreter.go: added PlannerOption to inject latebind decorator.
  • interpreter/late_binding.go: implementation of the IntepretableCall nodes that perform late binding.
  • cel/program.go: integration of the creation fo the late binding planner option into the interpretable construction.
  • cel/options.go: definition of the late binding options to be supplied toProgram.Eval(....).

Limitations:

This implementation is based on thefunctions.Overload and theinterpreter.Dispatcher abstractions. As a result, runtime signature checks are very limited, but the additional burden is kept to minimum. This is because differently fromdecls.FunctionDecl anddecls.OverloadDecl,functions.Overload does no longer maintain type information to perform any check.

If an implementations based on the abstractions in the decls namespace is preferred, I can uplift the PR.

@google-cla
Copy link

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View thisfailed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@hyp0th3rmi4hyp0th3rmi4 changed the titleFeatute/function late bind evalfeature: Late Bind Function Calls at Evaluation TimeApr 27, 2025
@hyp0th3rmi4
Copy link
Author

Some considerations on existing limitations:

Function Filters

At present time we allow for all functions to be overloaded, maybe it would be a good idea to control the behaviour for operators that are implemented as function. The current code already avoids to manipulateevalEq andevalNe but perhaps we should be able to allow for filtering out arithmetic operators.

Runtime Check for Signatures

This capability is implemented in a rather limited number, which relies on matching the specific function overload configured in the evalXXX node with the function overload supplied at runtime (unary -> unary, binary -> binary, function -> function). This is good as a first implementation but very low level. We can address this issue by moving fromfunctions.Overload todecls.FunctionDecl anddecls.OverloadDecl. If we do this, we may need to:

  • expose the overload configured indecls.OverloadDecl via aBinding() method to provide access from outside the package.
  • configure the lateBindEval interpretable with the selecteddecls.OverloadDecl
  • uplift the lateBindActivation to rely ondecls.OverloadDecl and no longer a dispatcher implementation.

Alternativaly, in thecel package we can provide a method that produces a LateBindActivation which is already checked against the defined functions in the environment implementation. With this approach, we do an ahead of time compatibility check versuse a real run-tme check.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@hyp0th3rmi4

[8]ページ先頭

©2009-2025 Movatter.jp