Comments (4)
The following yields the correct result, though I would expect a conflict:
import "list"
receipt: {
// Thanks for shopping at Big Kahuna Burger!
cheeseburger: 3.00
fries: 2.00
sprite: 1.00
total: list.Sum([for k, v in receipt {v}])
total: list.Sum([for k, v in receipt if k != "total" {v}])
}
Finally, the following yields a cycle error, as expected:
import "list"
receipt: {
// Thanks for shopping at Big Kahuna Burger.
cheeseburger: 3.00
fries: 2.00
sprite: 1.00
total: list.Sum([for k, v in receipt {v / 2}])
}
from cue.
Thanks very much for the report, @slewiskelly.
The new evaluator does see this as a cycle (the following test passes, as of f5b905c):
env CUE_EXPERIMENT=evalv3
! exec cue export x.cue
cmp stderr stderr.golden
-- x.cue --
import "list"
receipt: {
// Thanks for shopping at Big Kahuna Burger!
cheeseburger: 3.00
fries: 2.00
sprite: 1.00
total: list.Sum([for _, v in receipt {v}])
}
-- stderr.golden --
receipt.3: structural cycle:
./x.cue:10:18
from cue.
Sorry, I completely forgot to try with CUE_EXPERIMENT=evalv3
. As mentioned, this is identified as a cycle with that enabled:
$ CUE_EXPERIMENT=evalv3 cue export receipt.cue
receipt.3: structural cycle:
./receipt.cue:10:25
from cue.
@slewiskelly would you be happy with this issue being marked as resolved by the new evaluator, then? A number of issues around disjunctions, cycle detection, and performance are resolved thanks to the new evaluator's design, and our focus is on polishing up the new evaluator so that we may enable it by default for all users as soon as possible. Any time spent trying to backport any fixes to the old evaluator would slow down that transition, as you can imagine.
Just as with previous cases like #3149, I will still add a test case to the repository with your example, to make sure that it keeps working with the new evaluator.
from cue.
Related Issues (20)
- encoding/jsonschema: integrate JSON Schema test suite
- inversion of list.Contains() function's return doesn't work HOT 2
- encoding/jsonschema: OpenAPI schema versions HOT 1
- evaluator: SIGSEGV / Non-consistent output on list comprehension constraint HOT 5
- Reflection in CUE API HOT 2
- encoding/toml: more errors do not include location information
- encoding/jsonschema: implement not, oneof and anyof in terms of matchN
- encoding/jsonschema: additionalProperties false in top level object results in open struct HOT 1
- language: add not builtin HOT 1
- cmd/cue: use of --path with non-string value results in garbage output
- cmd/cue: interaction between --merge(=false) and --path, --list and --files needs to be defined HOT 1
- strings: provide functions for constraining length for bytes (or create a separate bytes package)
- matchN: inconsistent reporting of the full set of validation errors HOT 2
- matchN: reporting of non-concrete list-based validation failures is unhelpful
- cuelang.org: preprocessor: enable shell aliases in script blocks HOT 1
- evaluator: unresolved aliases in definitions fail to work after embedding
- Inconsistent behavior when evaluating disjunctions with default fields
- Erroneous structural cycle detection (and stack overflow) for macro HOT 1
- cuelang.org: allow an author to pre-populate a search box with a specific tag
- Feature Request: Internal packages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cue.