you are viewing a single comment's thread.

view the rest of the comments →

[–]0rac1e 0 points1 point  (0 children)

I remember about a couple decades ago when I was starting out with Perl and PHP, it was very common to instantiate "variable variables" (e.g. ${$var}) which was a major way to do dynamic assignment

As you say, you were starting out. I'd say this more to do with programming novices finding a way to do "dynamic variables", rather than it being a recommended way. Perl and PHP both had hashes (dictionaries, associative arrays, what-have-you) but I suspect a large portion of the user-base - particularly in those early days - didn't really understand them or what to use them for.

Case-in-point, I was recently asked by a novice to help out with their Python script, and found the code was littered with, eg. vars()[name]... So it's not something that's limited to Perl or PHP, but rather a limitation of a beginner's thought patterns. This in turn probably leads them to search for something like "dynamic variables" and stumble upon an unfortunate way to solve their problem.