I’m new to ruby and the Sketchup API. I’ve noticed some discussion of the problems of writing scripts that have no explicit module, and whose binding is TOPLEVEL_BINDING. IIUC, said binding is associated (and I’m not sure exactly this works) with the Object class.
If I write a such a script, and that script includes local variables, those variables are not visible in the console after I “load” the script. I have read that including a second argument of “true” with your “load” call will wrap the script in an anonymous module, preventing contamination of the namespace of the TOPLEVEL_BINDING with any constants from the script. In that case, the anonymous module is deleted on completion of the load.
My question is, what is the scope of local variables defined in a script which does NOT have the optional “wrap” argument? Do those variables disappear into the GC after completion of the script load process?