Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

IP types #878

Answered by myitcv
zachfi asked this question in Q&A
Apr 2, 2021 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

@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: 2 comments 2 replies

Comment options

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

@myitcv
Comment options

Answer selected by zachfi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants