call-by-name question: How would one retrieve a su...
# development
w
call-by-name question: How would one retrieve a subsystem? Currently you can
await Get(Subsystem)
. There is no equivalent i call-by-name. Should there be? E.g
await Subsystem.get_subsystem() # shed my bikes
.
I have used get
Get(Subsystem)
form inside e.g rule helpers to remove clutter from the top-level rule signature if only some code paths use said subsystem.
Example imitating real code:
Copy code
@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)
    ...
b
It's not really an answer, but could that
_helper
be a
@rule
that itself takes a
Subsystem
arg? I guess that only works if it's truly a separate function, though