News for hackers. Stuff that matters.
Re:Cue, an open-source data validation language by throwaway894345 on Tuesday June 15, 2021 @11:37AM (#27517009)
Consider this example: https://github.com/cuelang/cue/discussions/967

How would you solve this with directory structure and "function structs" respectively? I'm having trouble wrapping my head around the former and ran into shadowing problems with the latter.

Re:Cue, an open-source data validation language by dqpb on Tuesday June 15, 2021 @12:37PM (#27517887)
I would do it like this:

test.cue:

    #Job: {
        command: string
        args: string
        cli: "\(command) \(args)"
    }

    #GoJob: #Job & {
        command: "go"
    }

    #GoJobV: #GoJob & {
        args: "-v ./..."
    }

    job: #GoJobV.cli
Results in:

  $ cue export test.cue 
  {
      "job": "go -v ./..."
  }