Giter Site home page Giter Site logo

Comments (4)

slewiskelly avatar slewiskelly commented on August 27, 2024

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.

myitcv avatar myitcv commented on August 27, 2024

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.

slewiskelly avatar slewiskelly commented on August 27, 2024

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.

mvdan avatar mvdan commented on August 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.