Egregoros

Signal feed

Timeline

Post

Remote status

Replies

10
>tests
My code isn't even breaking it's a style thing. I specifically told it to avoid classes and just write procedural code but I ended up with all these "globals" declared in every function which are allegedly bad.
I don't really get why yet, but again, maybe I am just too bad of a programmer. No idea.
Grok keeps telling me it avoids problems but when I ask which ones, it's stuff like "if you use global foo and you forget the keyword once it will create a local variable instead and assign that."
Okay. Why? Why is that good? idgi

>types
another thing that I would rather have by default, but hasn't been an issue in my simple script here, yet.
My agent hasn't been off track with that yet. It's only a thousand lines (way too much if you ask me) at this point. Probably fits context easily.
I don't get why having closures is such a good thing.
duplicating the function and variables is by definition not just "absolutely necessary" memory but idk jack shit about functional so who knows how they do it.
In general though, claiming that Python programs become more readable when you use closures than with global state seems a bit dubious to me. Maybe I'd like it in functional programming though.
my naive answer would be isn't that more about control flow than the variable being global or not?
Calling an object that encapsulates the state doesn't make it more understandable than just having a global edit_mode_toggle and toggling that within program flow...

>, there is no duplication, the function chain compiles into an imperative loop
this is more of a stack overflow/google stupid question I guess, but if the function is just made once and the language internally just passes a pointer to the variables it needs on execution, isn't that just a bit of syntactic sugar around doing that yourself? where's the closure part come in?
I got a bit less sleep so apologies if this is a dumb thing to ask
@WandererUber @HatkeshiatorTND the variable being global doesn't change control flow but does obscure it and make the code as written not describe it without knowing the entire system
although for python it does indeed not matter as it has no concept of const so data dependencies are already obscured, so something being global doesn't obscure it more than it being in a state object

variables are already pointers in assembly. and yes you can spin up for loops with nested conditions that are equivalent to a zip.map.filter.fold chain, but it will be far less concise and readable than the functions that describe the logical transformations