Another EU 2.5 suggestion...

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

I would like to be able to set the value of a variable like this:
integer 
some_extremly_long_variable_name=82,another_extremly_long_variable_name=45

Instead of:
integer 
some_extremly_long_variable_name,another_extremly_long_variable_name 
some_extremly_long_variable_name=82 
another_extremly_long_variable_name=45

This would be much easeyer, especilly with long variable names.
This is already used in constants, so why not with regular variables?

And I would also REALLY like my other suggestions included:

"eval()" commands/crash callbacks/ect. for Euphoria 2.5?

Some of the following is missing from Euphoria and would be very
helpful to me and many other programmers. I would like to see this in
Eu 2.5. Please take these into consideration.


"eval()" commands:
I would really like to see a way to do an "eval()" type command.
Many other languages have something like this.

eval(sequence eval_commands,integer global_type,integer crash)
eval_commands is a sequence of commands
global_type is:
0-No routines/varibles (even global) exist in main program
1-Only routines/varibles declared as global exist in main program
2-All routines/varibles exist in main program

if crash is true, if it encounters an error (like 1/0) than the
program dies with (or a crash routine, see below) ex.err, otherwise, it 
returns an error 
code(like 5 for divide by 0,see below)


Example:
integer a,global_type
sequence eval_commands

eval_commands="
include incl_file.e--should allow including(This could be used 
--instead of complex "dynamic includeing" libraries)
if a then
	?a
end if"

a=7
var_type=1

?eval(eval_commands,global_type,0)
Displays:
7(value of a)
0(eval encountered no errors)

____________________________________________________________
Crash callback
A way to setup a callback function would allow programs to save user 
data before exiting
with ex.err

set_crash(integer routine_id)
routine_id is the routine id of the function
it calls the function with an error code(like 5 for divide by 0),
a sequence with info about the error(like a line #, invalid subscript, 
ect.)
and a text string with the complete text error message(
"test.ex:3
attempt to divide by 0")

if the function returns -1, ignore the error

Example:
function oncrash(integer err_code,sequence info,sequence msg)
if err_code=34 then--this error can be ignored in this program
	return -1
end if
save_all_important_data()
return 0
end function
set_crash(routine_id("oncrash"))

_________________________________________________

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

Search



Quick Links

User menu

Not signed in.

Misc Menu