Open rouilj opened 3 years ago
Hey, I thought about this, and have removed the context purposefully. I think the way my script is currently setup is better. The context variable ultimately is just a god object, and I didn't want this.
I'll leave the issue open, and if it gains traction and this is a more popular opinion, then I can support it. But if not, I'll leave it as is.
I see your point of not wanting a 'god' object. However, your slog could be much more complex than creating a user account and require several bits of information, that's where having a context with many parts to pass around may come in handy.
I vote for @rouilj
In the original https://blog.danslimmon.com/2019/07/15/do-nothing-scripting-the-key-to-gradual-automation/ the object/dict "context" is passed to each step. In your examples you pass a simple variable username.
Although the example only defines the "username" key in the context object/dict the role of context can't be replaced by a simple "username" variable.
The purpose of context as I see it is to pass information between the stages. So stage one can add:
Then stage2 can use this stage1key when doing its stage 2 things.
A simple variable depending on how it's passed (reference, value) to a stage doesn't allow the stage to make a change to the variable that is available to other stages. Also the choice of the name "username" isn't valid once the value is changes to something like a key.
There is value in seeing this model written in other languages, but I suggest you implement it with the original functionality that supports stages modifying and passing context between stages.