Metanet Programmer Directory

Talk about computers, hardware, applications, and consumer electronics.
User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.11.18 (06:02)

taaveti wrote:it can be pretty useful in the other direction ($local_variable=$$global_name). It beats the hell out of writing some stupid get_global_variable function which consists solely of a giant switch statement with a case for every global variable you might want to access (although my coworker, who has somewhat more education and less real-world experience than I have, would say that the accessor function with an explicit list of every allowed variable name is actually the better practice).
For one thing, it is very difficult to justify having any meaningfully large number of global variables. Having enough global variables as to make it annoying that one can't loop over them is indicative of terrible programming practice which should be corrected instead.
In the rare case that a large number of global variables are needed, it is convention to put them into a hash table (and it is a criminally stupid language which does not allow iteration over the keys of a hash table). This is how POSIX environmental variables are accessed, for example; C uses getenv(char*) in stdlib, Python uses os.environ, Ruby uses ENV, etc.

If your real-world experience is telling you that you need to decide between a large number of global variables and a function centered around a switch statement, I think you need to pull yourself out of industry and step into a classroom.
In any case (and I'll think you'll agree), the danger of variable variables is not worth this non-benefit.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Global Mod
Global Mod
Posts: 1416
Joined: 2008.09.26 (05:35)
NUMA Profile: http://nmaps.net/user/scythe33
MBTI Type: ENTP
Location: 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

Postby scythe » 2010.11.18 (10:41)

I should mention that anyone interested in ridiculous programming humor really ought to read /prog/.
As soon as we wish to be happier, we are no longer happy.

User avatar
Smoothest Taint in the West
Posts: 3241
Joined: 2008.09.29 (14:22)
NUMA Profile: http://nmaps.net/user/ska
Steam: www.steamcommunity.com/id/
Location: Australia

Postby ska » 2010.12.17 (00:36)

I am proficient in Multimedia Fusion 1 & 2. (e.g. The Games Factory 1 & 2)

Edit: Also add kkstrong/cucumber boy to Visual Basic.

User avatar
Retrofuturist
Posts: 3131
Joined: 2008.09.19 (06:55)
MBTI Type: ENTP
Location: California, USA
Contact:

Postby t̷s͢uk̕a͡t͜ư » 2010.12.17 (16:15)

Oh, I've been learning Android development for the last few days. I hope to get better at that.
[spoiler="you know i always joked that it would be scary as hell to run into DMX in a dark ally, but secretly when i say 'DMX' i really mean 'Tsukatu'." -kai]"... and when i say 'scary as hell' i really mean 'tight pink shirt'." -kai[/spoiler][/i]
spoiler

Image


User avatar
Queen of All Spiders
Posts: 4263
Joined: 2008.09.29 (03:54)
NUMA Profile: http://www.freeWoWgold.edu
MBTI Type: ENFP
Location: Quebec, Canada!

Postby SlappyMcGee » 2010.12.17 (18:01)

T̷s͢uk̕a͡t͜ư wrote:Oh, I've been learning Android development for the last few days. I hope to get better at that.
Very cool!
Loathes


Who is online

Users browsing this forum: No registered users and 10 guests