Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateful and stateless #1

Closed
chkworks opened this issue Feb 5, 2023 · 6 comments
Closed

Stateful and stateless #1

chkworks opened this issue Feb 5, 2023 · 6 comments

Comments

@chkworks
Copy link

chkworks commented Feb 5, 2023

Would it make sense to include a chapter about the differences of stateful and stateless nodes? IMO it would be really cool to have one ressource, which clarifies this in its wide importance in a similar manner like the tutorial about mutable vs. non-mutable. In the beginner series I am producing right now I am leaving topics like these out on purpose, because they would totally fit better in your series and I could link to them.

@TobyKLight
Copy link
Owner

Sounds like a great idea. I may not have time to do another big video for a while but I could do a patch at least.

What would be the key messages to illustrate?

Off the top of my head
-Static Operations are stateless,
-Processes, classes and records can have state, although they don't have to.
-How the state outputs work on records and classes
-Show how running something stateful inside a stateless context will constantly recreate it
-Importance of using Create with Records and Classes to initialise inner state properly

@chkworks
Copy link
Author

chkworks commented Feb 7, 2023

I would not have even thought of all these, and I could also greatly benefit from that.

Maybe also how stateful nodes are indicated with a bar in the node?
Also that delegates are stateless? I interpret them as kind of an inverse implementation of a static operation.

@TobyKLight
Copy link
Owner

Ok I added a Stateful vs Stateless patch in v1.0.4. Should be uploaded shortly. Check it out and let me know what you think.

I didn't put in the bars because records don't have bars and I consider them more on the stateful side as long as you save them somewhere, which I think is their intended use.

I also would like to deep dive to cover delegates in a future tutorial so I left that out for now.

@chkworks
Copy link
Author

Awesome! Thank you for sharing this! Just writing down all thoughts that popped in my head while going through this.

Okay... the bars would just indicate a Process and not a stateful patch? I noticed that the first time.

Also I liked the mentioning of that stateful nodes have pads. Is the difference really just that simple?

So in that case, this warning should actually only be yellow, when the process contains at least one pad?
grafik

Also: the last frame in your patch "Providing state from outside a static operation" directly docks to the concepts in this forum thread, right?
https://discourse.vvvv.org/t/naive-questions-about-textures-and-delegates/20622

@TobyKLight
Copy link
Owner

TobyKLight commented Mar 6, 2023

Sorry for slow reply!

Yes I think the bars are just for a process.

As far as I know yes you have to have pads in order to be stateful... I didn't think of it that simple myself but I guess that is the only way to store anything without external IO. (eg write a file to disk... is that stateful? Debatable but I think probably not in the context of talking about vvvv nodes)

I like your idea of limiting the warning to when the process has pads.. Makes sense to me, although maybe the devvvs have other reasons.

In terms of the thread... I don't think the solution you are looking for is about a need to update state in a stateless context, I think you ran into three different problems:

  • Delegates are stateless, but of course the documentation for delegates is incomplete at this time so how are you meant to know that?
  • It happens to be a quirk of the graphics pipeline that blur is a stateful process.
    Conceptually I would agree with your initial approach and see blur as stateless transformation of a texture, it goes in, gets blurred, goes out.
  • Lastly the role of delegates and interfaces as providing customisable behaviour is also not well documented. In the gray book interface still says 'not officially supported'. So again how are you meant to know interface would allow you to provide stateful behaviours?

I sympathise with you. I find learning this way quite frustrating.

@TobyKLight
Copy link
Owner

I added an extra case to stateful vs stateless tutorial with exactly the example you had with blur in case anyone runs into this in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants