And is there any other way to create variables in a dynamical manner,
using something else than eval(), or can only the parser create
variables?
Greetings,
Geert.
···
-----Original Message-----
From: Robert Klemme [mailto:bob.news@gmx.net]
Sent: 30 May 2005 14:55
To: ruby-talk ML
Subject: Re: creating variable with eval
This comes up again and again. You might want to search the archives.
Short story: Ruby determines local variables at parse time. Although
you
can bind values to local vars with eval you cannot access them outside
of
eval because they are not known there:
And is there any other way to create variables in a dynamical manner,
using something else than eval(), or can only the parser create
variables?
Greetings,
Geert.
You do in fact create them as one of my examples showed:
.... but they cannot be accessed from code that was compiled prior to
calling eval.
robert
···
-----Original Message-----
From: Robert Klemme [mailto:bob.news@gmx.net]
Sent: 30 May 2005 14:55
To: ruby-talk ML
Subject: Re: creating variable with eval
This comes up again and again. You might want to search the archives.
Short story: Ruby determines local variables at parse time. Although
you
can bind values to local vars with eval you cannot access them outside
of
eval because they are not known there: