Wish: variable_id()

new topic     » topic index » view thread      » older message » newer message

It has been suggested before to add the ability to parse/execute strings 
as Euphoria code, which would be terrific, but short of that, how about 
variable_id(), which ought to be in the realm of possibility, plus we've 
already got routine_id(), and it is lonely.

The ability to look up variables by their names ala variable_id("x") 
would make it trivial to make a user-created expression evaluator 
without all sorts of code for assigning variables.  Of course, along 
with variable_id() we'd need a couple of extra functions to make 
assignments & lookup values via id -- i.e. get_value(v_id) & 
assign(v_id, new_value).  Or maybe just make available a special array 
of all variables accessible within the current scope as is done in some 
languages. [ i.e.  VAR_ARRAY[4] = new_value; find("x",VAR_ARRAY_NAMES), 
etc. ]

Unlike many suggestions for new features, which are shortcuts that might 
make things easier but don't add new functionality to the language, this 
would open up all sorts of new possibilities that currently are...well, 
not possible.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu