Replies: 3 comments 2 replies
-
I'm missing the Slack context, but it is a bit of semantics here. It creates an on-the-fly instance, but I don't think that answers your question. Here are some orthogonal rules:
The API can return an |
Beta Was this translation helpful? Give feedback.
-
(For the record, I edited the original question here to include the conversation history (copy-pasted via https://stackedit.io which does a very nice job of converting rich-text rendered in the Slack (web) app to markdown)) |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#973. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
-
Continuing from preceding discussion in the "language" channel (see below) of the "CUE" Slack workspace, when one invokes the cue tool against a set of CUE files that lack a package declaration, is that still considered to be processing an instance, or do instances only exist for packages within a CUE module?
My repeated reading of the “Instances” document tells me that the instance concept only makes sense within modules, as it’s both disambiguating a view of a package (among many potential views across the module’s directories) and combining files in a way that’s only sensible in the context of a module.
The CUE source code is less clear on the matter. Looking at the
Instance
struct type, I see that the “Module” field is optional. ThecueFilesPackage
function returns a*build.Instance
, and cue calls on that function to load the files listed on the command line. Is abuild.Instance
the same as the notional instance involving file ancestry within a module?Slack conversation history
seh 6 May at 16:56
When one invokes the cue tool against a set of CUE files that lack a package declaration, is that still considered to be processing an instance, or do instances only exist for packages within a CUE module?
Tony Worm 25 days ago
they get an implicit "main" package applied behind the scenes iirc
seh 25 days ago
And is that then an instance of that synthesized package?
Tony Worm 25 days ago
My understanding is that is a package like any other
seh 25 days ago
I get that, but CUE uses instances to distinguish between multiple views or subsets of the same nominal package. In this case, there can be only one view of it, but I don’t know if that’s still considered to be an instance or not.
seh 25 days ago
Based on the discussion here, it sounds like the answer could be no, because there are no transitive ancestor directories to consider, since we’re not in a module.Then again, the answer could instead be yes, but with an empty set of ancestor directories, for lack of a module.
seh 25 days ago
Looking at the
Instance
struct defined here, I see that the “Module” field is optional.instance.go
Tony Worm 24 days ago
One thing I've never been clear on is when
load.Instances
would return more than one instance. I haven't seen it do so in my code anyhowseh 24 days ago
And here, the
cueFilesPackage
function returns anInstance
.loader.go
Beta Was this translation helpful? Give feedback.
All reactions