Skip to content

Revamp functions to support methods and simplify overloads#260

Merged
srikrsna-buf merged 1 commit intomainfrom
sk/funcs
Jan 19, 2026
Merged

Revamp functions to support methods and simplify overloads#260
srikrsna-buf merged 1 commit intomainfrom
sk/funcs

Conversation

@srikrsna-buf
Copy link
Member

First of a few PRs to support a new way of dealing with functions. Adds support for distinguishing between methods and functions and a derived and stable id for each overload. This does away with the notion of overloads from the public api and simplifies creating functions and methods.

This PR doesn't yet change any of the standard/extension functions provided in the package as that will be huge diff, instead it adds a compatibility layer from the old way to the new. Once we migrate all of them, this layer will be removed.

Comment on lines +194 to +197
/**
* Temporary glue code for transistion.
*/
export function registryToFunctions(registry: FuncRegistry): CelFunc[] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and below will be removed once we migrate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file will be deleted once we migrate

Comment on lines +52 to +54
function (b) {
return this.toLowerCase() == b.toLowerCase();
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice the this in the function. For methods this implementation uses this instead of making the first argument the target. Felt like a clear way to distinguish between function and method implementations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will replace the new func.ts once we complete the migration.

@srikrsna-buf srikrsna-buf merged commit 5de2962 into main Jan 19, 2026
12 checks passed
@srikrsna-buf srikrsna-buf deleted the sk/funcs branch January 19, 2026 13:00
This was referenced Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants