https://pantsbuild.org/ logo
#general
Title
# general
c

curved-television-6568

12/14/2021, 10:03 AM
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

witty-crayon-22786

12/14/2021, 5:56 PM
this might relate to https://github.com/pantsbuild/pants/issues/13851… the validation will need to see whether the field defaulted
👍 1
h

hundreds-father-404

12/21/2021, 7:58 PM
True. What's the use case? Or a general observation?
c

curved-television-6568

12/21/2021, 8:04 PM
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

hundreds-father-404

12/21/2021, 8:18 PM
Makes sense. I wonder how we could solve this. Maybe something like a sentinel value
c

curved-television-6568

12/21/2021, 10:03 PM
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

hundreds-father-404

12/21/2021, 10:05 PM
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

curved-television-6568

12/21/2021, 10:06 PM
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

hundreds-father-404

12/21/2021, 10:07 PM
Yes, thanks :)
👌 1