I have a minor nit regarding field values I’d like...
# general
c
I have a minor nit regarding field values I’d like to address. And that is default values vs
None
. 🧵
Assume we have a field, with a default value
"humbug"
, but where also
None
is valid. There is currently no way to override the default value and get
None
as it is today.
I suggest making a distinction between if the field is set to
None
vs not at all.
And possibly, by extension, if the value comes from the default value, of it it was provided in the BUILD file.
w
this might relate to https://github.com/pantsbuild/pants/issues/13851… the validation will need to see whether the field defaulted
👍 1
h
True. What's the use case? Or a general observation?
c
My initial use case was resolved in another way (by offering optional error on glob mismatch) for the
docker_image
source field.
Initially (or there abouts) I had a desire to be able to set the value to
None
when the default was
"Dockerfile"
.
So, currently I have no use case, but I can imagine I’m going to run into this in the future…
So basically, as it is, if there is a default value, you can’t ever set it to
None
even if that is an acceptable, albeit non-default, value.
👍 1
h
Makes sense. I wonder how we could solve this. Maybe something like a sentinel value
c
I think it doesn’t have to be too fancy.. something during compute_value, maybe (haven’t thought about it for a while, though..)
But given you agree, I can look into it…
h
Agreement == acknowledgement this could be improved + curiosity what that would look like. But I'm not certain I think we should fix it no matter what, might be that the fix is too complex
c
Right, so by look into it, would be to see what a possible fix would look like (which we can discard if it is not easily done.. 🙂 ). Sounds good?
👍 1
h
Yes, thanks :)
👌 1