-- Leo's gemini proxy

-- Connecting to freeshell.de:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en-GB

Variable scope acts like a devil for the user 👿

In PocketCode, you make visible objects and attach code to them. When you create variables, the scopes seem clear:

"For all actors, objects and clones in all scenes"

"For this actor, object, or one of its clones only"


You can clone an object to get more than one. The variables in scope 2 are only available to the clones. But...


If you update a variable in one of the clones, the others don't see the change. When you make a clone, the current *value* is given to the clonee but the cloner keeps its own copy.


So my code for keeping track of the number of active clones fails.


Is it coming across that I'm quite annoyed by this? I'M QUITE ANNOYED ABOUT THIS.


And the only other option is a global.


#PocketCode

#programming


back to gemlog

-- Response ended

-- Page fetched on Fri May 3 23:06:27 2024