proofit404 / stories

Service objects designed with OOP in mind.
https://proofit404.github.io/stories/
BSD 2-Clause "Simplified" License
297 stars 21 forks source link

State union should merge different Argument declarations. #687

Closed proofit404 closed 1 year ago

proofit404 commented 3 years ago
class A1State(State):
    a1v1 = Argument()

class A2State(State):
    a2v1 = Argument()

NewState = A1State & A2State

The NewState would have both a1v1 and a2v1 arguments declared.

If name was declared as argument at least in one State of the union, it will be allowed to be used as an argument. Even if in other states it was declared as variable.

proofit404 commented 2 years ago

Having a union of many states could look awful with chosen syntax.

state_class = (
    A1State
    & A2State
    & A3State
    & A4State
    & A5State
    & A6State
    & A7State
    & A8State
    & A9State
    & A10State
)
state_class = Union(
    A1State,
    A2State,
    A3State,
    A4State,
    A5State,
    A6State,
    A7State,
    A8State,
    A9State,
    A10State,
)
proofit404 commented 2 years ago

Even more boilerplate could be reduced if we would be able to merge all state subclasses from different namespaces.

state_class = Union(cases.usecases.scopes, bot.usecases.scopes)
proofit404 commented 1 year ago

Superseded by #722