Malleable Instance Vars

Are we ready for

  @x = 1

  a = "x"

  @{a} #=> 1

T.

Not me, but how about:

     container@[index]

as sugar for:

     self.container@(index)

and

     container@[index] = val

as sugar for:

     self.container@=(index, val)

As a degenerative case you could omit the 'container':

     def @(index); end
     def @=(index); end

Gary Wright

···

On Oct 29, 2005, at 2:57 PM, Trans wrote:

Are we ready for

  @x = 1

  a = "x"

  @{a} #=> 1

PHP-style "variable variables" just lead to code that is too clever for its own good. Using a Hash is a much more readable solution.

···

On Oct 29, 2005, at 11:57 AM, Trans wrote:

Are we ready for

  @x = 1

  a = "x"

  @{a} #=> 1

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Eric Hodel wrote:

···

On Oct 29, 2005, at 11:57 AM, Trans wrote:

> Are we ready for
>
> @x = 1
>
> a = "x"
>
> @{a} #=> 1

PHP-style "variable variables" just lead to code that is too clever
for its own good. Using a Hash is a much more readable solution.

Perhaps so. And I am presently working on such code. BUt to be honest,
I haven't found a more reasonble way to handle it. As it stands I have
to do instance_variable_get/set or eval the whoe method def.

T.