Is there a way to rename default declarations?

45 views
Skip to first unread message

An Wa

unread,
Jul 28, 2023, 3:56:05 AM7/28/23
to CEL Go Discussion Forum
Hi everyone,

I want to use type for own purposes. If I do so, I get the following error:
overlapping identifier for name 'type'

Is there a way to rename the default declaration to something else? E.g. typeof

I've found a way with v1.3 and a custom env. With the latest version the name of the types is not exposed anymore. Maybe there is a way with a custom provider, but I could not find an example.

Thanks!

Tristan Swadell

unread,
Jul 31, 2023, 12:56:12 PM7/31/23
to An Wa, CEL Go Discussion Forum
I would recommend creating a separate namespaced variable / function rather than try to rename CEL built-ins. e.g. aw.type

If the value is intended to be a variable or a function you'd declare it using the `cel.Function` or `cel.Variable` options, and if it's intended to be a type, they you could use the `types.Registry` or a custom type provider to expose it.

Hope that helps,

-Tristan

--
You received this message because you are subscribed to the Google Groups "CEL Go Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cel-go-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cel-go-discuss/8e2f41ab-d5b1-49ee-b5d4-5e16d6225fe3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages