3 ms·
Like Php and other languages, Ruby has one severe sickness: “One thing Perl’s my() gives you is a guarantee that you aren’t stomping on a given variable. For ex
by olaf 14y ago
Like Php and other languages, Ruby has one severe sickness:
“One thing Perl’s my() gives you is a guarantee that you aren’t stomping on a given variable. For example, if I’m in a block of code in Perl and want to use a private variable I can just declare it with my() and never have to worry about whether a variable of that name existed previously. In Ruby, if you are inside of a block and want a private variable, you need to choose a variable name that has never been used before. I don’t want to have to hold the entire symbol table in my head!! What can I do?”
source: http://gabrito.com/post/ruby-needs-my-for-variable-declaration-and-scoping http://gabrito.com/post/ruby-needs-my-for-variable-declarati...