Jump to content

globals in udfs


Recommended Posts

i finished writing a huge function and after careful review figured i break it down into several key functions to save space , readability, etc.

now i read that it is advised to use locals but i would have to pass over unseemingly many parameters to my functions, which instead could just be global vars. saw it in several other udfs too, but im unsure what is better :D

gist of my rambling: many globals ok/big nono/some ok ?

Link to comment
Share on other sites

When I write functions I like to see them as independent pieces of code that works regardless of how a function before behaved, and I also like to be able to change one function without having to consider the other functions in my script. This is somewhat broken if you decide to go with many globals since other functions may interfer with data that other functions is supposed to get. This could make debugging hard. But on the other hand, passing around data that most likely never changes is just plain stupid. I guess a mixture is the best. :D

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...