hundreds-father-404
03/13/2020, 3:08 PMmy_tgt.get(Compatibility)
, you get back an instance of Compatibility
that no longer knows what the owning target is. That’s intentional - we want Fields to be first class citizens that can be used by multiple distinct target types, eg so that plugin authors can use that same Field without Pants caring that it’s a new target
The other key detail is that all field hydration and/or validation is now lazy. We don’t validate my_tgt.get(Compatibility)
, only my_tgt.get(Compatibility).value
, where .value
is a property on the Field
If our concern was performance, we could stop making Field
be a frozen dataclass and inject Address
onto the Field
only when it was called via Target.get
. Or, even in Target.get
, return a new Field
with the Address
configured on the frozen Field
. Both approaches have serious downsides, but avoid storing Address
on every field used by the Pants run, until we know we actually need those fields