bonsai-rx / bonsai

The compiler, IDE, and standard library for the Bonsai visual programming language for reactive systems
https://bonsai-rx.org
MIT License
136 stars 28 forks source link

Consider allowing static Process methods #1943

Open glopesdev opened 1 month ago

glopesdev commented 1 month ago

It can happen in some pure implementations of reactive operators that the implementation of the combinator method does not require any local operator state. In this case the Process or Generate function could be marked as static.

This should be allowed to avoid having to pass the operator instance into the method call. Care must be taken when evaluating overloads.

PathogenDavid commented 1 month ago

This should be allowed to avoid having to pass the operator instance into the method call.

Why? What makes this valuable?

glopesdev commented 1 month ago

Why? What makes this valuable?

Maybe nothing apart from pleasing the gods of code suggestions, they keep highlighting that "this code could be marked as static". I don't know if there would be any performance optimizations to executing static methods over instance methods, but other than that I agree there is not a compelling reason to do this, just added it in here as a thought record.

PathogenDavid commented 1 month ago

The code suggestion gods are lesser gods and their advice need not necessarily be heeded.

I'd be more inclined to offer a Bonsai Roslyn analyzer which suppresses these suggestions.

performance

The performance difference would be absolutely minuscule (to the point it'd be hard to even measure.)