https://pantsbuild.org/ logo
#development
Title
# development
b

bitter-ability-32190

09/01/2022, 5:35 PM
Consider this a Pants engine joke:
Copy code
class X:
    async def helper():
        pass

class Y(X):
    async def helper():
        return await Get(Snapshot, PathGlobs(["..."]))

@rule
async def my_rule(request: RequestType) -> RetType:
    if False:
        # Just for static scraping purposes
        Get(Snapshot, PathGlobs, None)

    x_or_y: X = get_some_X_or_Y_instance()
    foo = await x_or_y.helper()
    ...
Which I think might be the gist of Stu's `union`+`rule_helper` idea 😮
a

ancient-vegetable-10556

09/01/2022, 5:38 PM
(I presume the goal here is to be able to write rules that dispatch on the subtypes, yes?)
b

bitter-ability-32190

09/01/2022, 5:38 PM
Ideally. Although, of course, this is presented as a joke because it's an abuse of the system 🙂
w

witty-crayon-22786

09/01/2022, 9:57 PM
yea, that’s it.
b

bitter-ability-32190

09/01/2022, 9:58 PM
I thought I might need to implement this for the
lint
changes, but turns out I don't. Still glad I finally understand the issue comment 😅
w

witty-crayon-22786

09/01/2022, 9:59 PM
yea, sorry… that was haphazard.
b

bitter-ability-32190

09/01/2022, 9:59 PM
Lol no worries. I DO NOT wanna try and debug THAT rule graph error though, when one does occur 😅
w

witty-crayon-22786

09/01/2022, 10:01 PM
yea. i hate implementing https://github.com/pantsbuild/pants/pull/16717 in the current rule graph solving algorithm, because it’s so complex already. really want to revisit the refactor i have there.
it was probably always a separate idea/feature, but i wanted to connect it to the biggest “`@union` API” ticket that was already open
a

ancient-vegetable-10556

09/02/2022, 8:49 PM
Oh dear @bitter-ability-32190, you made a joke and it resulted in an issue getting opened. I hope you’re happy 😆
😉 1