Skip to content

IP types #878

Answered by cueckoo
cueckoo asked this question in Q&A
Jul 3, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Original reply by @myitcv in cuelang/cue#878 (comment)

@xaque208 this is a bit subtle, not least because of #863. There is a constant goal to improve documentation and with the release yesterday of v0.3.0 we can start to take more steps towards that goal.

The subtle point here is that net.IP() can be used as a zero-argument constraint, even though it appears it requires and argument:

package x

import "net"

#machine: {
	ip: net.IP()
}

laptop: #machine & {
	ip: "4.4.4.4"
}

desktop: #machine & {
	ip: "4.4.4.x"
}

If you run the above as follows:

$ cue export
desktop.ip: invalid value "4.4.4.x" (does not satisfy net.IP):
    ./x.cue:6:6
    ./x.cue:14:6

Replies: 1 comment 2 replies

Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
2 replies
@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

Answer selected by cueckoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant