-
Notifications
You must be signed in to change notification settings - Fork 269
Update intro examples #177
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TristonianJones
wants to merge
3
commits into
google:master
Choose a base branch
from
TristonianJones:langdef-update
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -632,7 +632,7 @@ A CEL expression is parsed and evaluated in the scope of a particular protocol | |
| buffer package, which controls name resolution as described above, and a binding | ||
| context, which binds identifiers to values, errors, and functions. A given | ||
| identifier has different meanings as a function name or as a variable, depending | ||
| on the use. For instance in the expression `size(requests) > size`, the first | ||
| on the use. For instance in the expression `requests.size() > size`, the first | ||
| `size` is a function, and the second is a variable. | ||
|
|
||
| The CEL implementation provides mechanisms for adding bindings of variable names | ||
|
|
@@ -914,7 +914,7 @@ size of the inputs. | |
| cost of `O(P * I)`, and see below. | ||
| * Eliminating all of the above and using only default-cost functions, plus | ||
| aggregate literals, time and space are limited `O(P * I)`. | ||
| A limiting time example is `size(x) + size(x) + ...`. | ||
| A limiting time example is `x.size() + x.size() + ...`. | ||
| A limiting time and space example is `[x, x, ..., x]`. | ||
|
|
||
| Note that custom function will alter this analysis if they are more expensive | ||
|
|
@@ -942,31 +942,31 @@ specified by the following overloads: | |
| size | ||
| </th> | ||
| <td> | ||
| (string) -> int | ||
| string.() -> int | ||
| </td> | ||
| <td> | ||
| string length | ||
| number of unicode codepoints in the string | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| (bytes) -> int | ||
| bytes.() -> int | ||
| </td> | ||
| <td> | ||
| bytes length | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| (list(A)) -> int | ||
| list(A).() -> int | ||
| </td> | ||
| <td> | ||
| list size | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| (map(A, B)) -> int | ||
| map(A, B).() -> int | ||
| </td> | ||
| <td> | ||
| map size | ||
|
|
@@ -2152,14 +2152,30 @@ See [cel-go/issues/9](https://github.com/google/cel-go/issues/9). | |
| </td> | ||
| </tr> | ||
| <tr> | ||
| <th rowspan="4"> | ||
| <th rowspan="8"> | ||
| size | ||
| </th> | ||
| <td> | ||
| string.() -> int | ||
| </td> | ||
| <td> | ||
| number of unicode codepoints in the string | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| (string) -> int | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mark the function-style overload as "deprecated", here and below. (Boy, I wish we had adapted Uniform Function Call Syntax and we wouldn't have had to worry about any of this.) |
||
| </td> | ||
| <td> | ||
| string length | ||
| number of unicode codepoints in the string | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| bytes.() -> int | ||
| </td> | ||
| <td> | ||
| bytes length | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
|
|
@@ -2170,6 +2186,14 @@ See [cel-go/issues/9](https://github.com/google/cel-go/issues/9). | |
| bytes length | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| list(A).() -> int | ||
| </td> | ||
| <td> | ||
| list size. Time cost proportional to the length of the list. | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| (list(A)) -> int | ||
|
|
@@ -2178,6 +2202,14 @@ See [cel-go/issues/9](https://github.com/google/cel-go/issues/9). | |
| list size. Time cost proportional to the length of the list. | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| map(A, B).() -> int | ||
| </td> | ||
| <td> | ||
| map size. Time cost proportional to the number of entries. | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
| (map(A, B)) -> int | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm okay marking the function-style version as "deprecated", but I don't think it's okay to just remove it. Anyone attempting to implement a compatible CEL implementation will need to provide the function-style versions for the foreseeable future, so it ought to be in the language spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, now it's a confusing example because we're not listing the full set of overloads. Unfortunately, the other functions with multiple overloads are either:
get*()functions on timestamps and durations, but we're going to deprecate them on the durations.dyn().So consider whether there's a better example to use here, but I'm okay with just the receiver-style size functions if you don't think there's a better alternative.