Sy Ali
9/10/2006 3:53:00 PM
On 9/10/06, David Vallner <david@vallner.net> wrote:
> > ab = "pass"
> > puts ("a" + "b").to_variable
>
> This sounds very, very PHP to me. And subjectively speaking, I think
> variable variables from that language are the worst abomination in a
> structured programming language since VB goto.
>
> Does that really make code clearer instead of just "clever"?
I know nothing of PHP, but this trick would make my code much clearer.
With David.first's recommendation of instance_variable_get I can
re-use blocks of code much more intelligently.
Previously, I've been duplicating methods and just renaming a single
variable.. (just to ensure that method1 works the same as method2) a
variation of this would be cleaner I think.
My code is still quite hackish, so it's likely that I'll figure things
out in some time, and will be able to evolve towards even cleaner
code, perhaps dropping this trick.
Thanks for the help Davids.. =)