[Bf-committers] Temporary "global" storage

Jason Wilkins jason.a.wilkins at gmail.com
Fri Jun 22 10:35:12 CEST 2012


Think about it for a couple of seconds though.  Something like "last
button pressed" and "tooltip close time" really are globals.

In what parallel dimension did another button get pressed last?

In what other timeline did a tooltip close?

I get that somebody once told you that global variables are bad but
they are not.  What is bad is exposing the internal workings of
something to another module that does not need to know.  This happens
at all levels of code.

So, don't just make an "extern float last_tooltip_close_time", but
write a sensible interface for it like the other thousands of "global"
functions in Blender.

Even if someday we add dimensional sliding and time travel libraries
to Blender I don't think it will be a big deal to modify the interface
you make :-)


On Thu, Jun 21, 2012 at 6:50 PM, Jorge Rodriguez
<jorge at lunarworkshop.com> wrote:
> Uncle_Entity suggested in IRC that I should try G or G.main. G has a lot of
> assorted, almost random stuff in it. It's not the best place for it since
> it's still a glorified global, but it's not serialized to disk and it
> wouldn't have other averse consequences like exposing to Python scripts. I
> think I'm going to try with this if others don't object.
>
> --
> Jorge "Vino" Rodriguez
> jorge at lunarworkshop.com
> [ Tweet <http://twitter.com/vinobs> | Like <http://www.facebook.com/bsvino>|
> Plus <http://www.google.com/profiles/bs.vino> ]
> 919.757.3066
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers


More information about the Bf-committers mailing list