After having a hayday fiddling with this[] and that[]'s, I'm starting to wonder what the point of having normal "var/this = 0" variables is at all? Using the []'s format (whatever you call it) allows for variables that don't even need to be defined, anywhere you want you can just use if(this["Whatever variable you make up"]) and it'll work just fine, although it defaults to 0. Just set the same made up variable to 1 somewhere and poof, whole new variable!
But, is this too simple to be correct? It seems it's so easy to use, there must be SOME bad side effect to it. So, any experts on this out there, fill me in, would you?
ID:154258
Feb 27 2002, 2:19 pm
|
|
Foomer wrote:
After having a hayday fiddling with this[] and that[]'s, I'm starting to wonder what the point of having normal "var/this = 0" variables is at all? Using the []'s format (whatever you call it) allows for variables that don't even need to be defined, anywhere you want you can just use if(this["Whatever variable you make up"]) and it'll work just fine, although it defaults to 0. Just set the same made up variable to 1 somewhere and poof, whole new variable! I'm not entirely clear on what you mean here. Are you asking why we should define specific vars instead of using associative lists for everything? Associative lists are great, but they're not a catch-all. By using them for all or most of your vars, you'll have a few problems:
|
In response to Lummox JR
|
|
|
In response to ACWraith
|
|
The downside of always using lists is that you could hit the limit of 65535 lists at a time rather quickly. Using "normal" vars will avoid taking from your list resources. I hope Dantom vaporizes that tiny limit sometime soon... |
In response to AbyssDragon
|
|
AbyssDragon wrote:
|
if (this["Whatever variable you make up"])
says the var named this is a list and you want to know if the value associated with "Whatever variable you make up" is true.
The downside of always using lists is that you could hit the limit of 65535 lists at a time rather quickly. Using "normal" vars will avoid taking from your list resources.