worried-painter-31382
08/04/2024, 9:19 PMawait Get(Subsystem) . There is no equivalent i call-by-name. Should there be?
E.g await Subsystem.get_subsystem() # shed my bikes .worried-painter-31382
08/04/2024, 9:20 PMGet(Subsystem) form inside e.g rule helpers to remove clutter from the top-level rule signature if only some code paths use said subsystem.worried-painter-31382
08/04/2024, 9:23 PM@rule
def the_rule(a: A, b: B):
if use_system:
return await _helper_that_does_use_system(a)
else:
return await _helper_that_doesnt(a, b)
async def _helper_that_does_use_system(a: A) -> ...:
sub = await Get(Subsystem)
...broad-processor-92400
08/04/2024, 9:58 PM_helper be a @rule that itself takes a Subsystem arg? I guess that only works if it's truly a separate function, thoughbroad-processor-92400
08/04/2024, 10:27 PMpants.option.subsystem._construct_subsystem https://github.com/pantsbuild/pants/blob/a2acb196216ce5cabe45ee6a039eb5d5f530777a/src/python/pants/option/subsystem.py#L318-L320 when reviewing https://github.com/pantsbuild/pants/pull/21258