1. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by CoJaBo <cojabo at suscom.net> Jan 13, 2004
- 367 views
Does anyone agree? CoJaBo wrote: > > > 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")) > > _________________________________________________ > > > routine_id() for variables > I would like to see a varible_id systym (like routine id) > example: > integer a,a_id a=3 > a_id=var_id("a") > ?get_var(a_id) > --displays 3 > set_var(a_id,4) > --a now is 4 > _________________________________________________________ > and mayby a way to see if a var exists/is set > Example: > integer a,b a=1 > ?is_var_set("a") > --1 because a is set > > ?is_var_set("b") > --0 because b exists, but is not set > > ?is_var_set("c") > -- -1 because c doesn't exist > ____________________________________________________________ >
2. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by "Kat" <gertie at visionsix.com> Jan 13, 2004
- 365 views
On 13 Jan 2004, at 22:52, CoJaBo wrote: > > > Does anyone agree? I agree, see notes below........ > CoJaBo wrote: > > > > > > 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. RobC said no already, over and over, so Karl added it to Bach. Try it, it's plenty fast over any interpreter written in Eu in the archives. > > _________________________________________________ > > Crash callback > > A way to setup a callback function would allow programs to save user > > data before exiting > > with ex.err I agree. Most do. RobC didn't. > > set_crash(integer routine_id) Ditto. > > _________________________________________________ > > > > > > routine_id() for variables > > I would like to see a varible_id systym (like routine id) > > example: > > integer a,a_id a=3 > > a_id=var_id("a") > > ?get_var(a_id) > > --displays 3 > > set_var(a_id,4) > > --a now is 4 Well, could be less complicated than that, but RobC said no, and Karl has said maybe (i think). If Eu used one byte per ascii char, this could be more useful than it would be now. It could be otherwise useful in dos32 semi- threaded apps if the app and var locations weren't paged out from under the known memory locations. > > and mayby a way to see if a var exists/is set Ditto, RobC said no. Karl may add it to Bach. It's handy in mirc. But then, you can build your own var names in mirc while it's running, which is *very* handy. You can use associated lists (Jiri and others have written them), or you could use pokes/peeks into memory (others have written those). Both approaches are likely much slower than if implemented in core Eu. The associated lists in Eu are faster than in mirc, especially if you wanna wildmatch var names, such as: 1) this.is.a.var.name 2) this.is.also.a.var.name varfind({this.is.*.var.name}) wildfind({"var","name","this.is"}) In mirc, this is what i do: if (%varname != $null ) { do something } if ( %var.* != $null ) { do something } if ( %var. [ $+ [ %var2 ] ] != $null ) { do something } if ( %var. [ $+ [ %var2 ] $+ .etc ] != $null ) { ds } etc etc. Kat
3. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by CoJaBo <cojabo at suscom.net> Jan 14, 2004
- 363 views
I don't see why Euphoria can't support at least the first two. A way to recvor from errors is almost absolutly nessescery in programs=20 that have a lot of user data when they might crash.(like Win32Lib IDE) Almost all other languages I've used had an "eval()" command, this would= =20 be very useful in Euphoria. Kat wrote: >=20 >=20 > On 13 Jan 2004, at 22:52, CoJaBo wrote: >=20 > >=20 > >=20 > > Does anyone agree? >=20 > I agree, see notes below........=20 >=20=20 > > CoJaBo wrote: > > >=20 > > >=20 > > > 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. > > >=20 > > >=20 > > > "eval()" commands: > > > I would really like to see a way to do an "eval()" type command. > > > Many other languages have something like this. >=20 > RobC said no already, over and over, so Karl added it to Bach. Try it,= =20 > it's=20 > plenty fast over any interpreter written in Eu in the archives. >=20 > > > _________________________________________________ > > > Crash callback > > > A way to setup a callback function would allow programs to save user= =20 > > > data before exiting > > > with ex.err >=20 > I agree. Most do. RobC didn't. >=20 > > > set_crash(integer routine_id) >=20 > Ditto. >=20 > > > _________________________________________________ > > >=20 > > >=20 > > > routine_id() for variables > > > I would like to see a varible_id systym (like routine id) > > > example: > > > integer a,a_id a=3D3 > > > a_id=3Dvar_id("a") > > > ?get_var(a_id) > > > --displays 3 > > > set_var(a_id,4) > > > --a now is 4 >=20 > Well, could be less complicated than that, but RobC said no, and Karl=20 > has=20 > said maybe (i think). If Eu used one byte per ascii char, this could be= =20 > more=20 > useful than it would be now. It could be otherwise useful in dos32 semi- > threaded apps if the app and var locations weren't paged out from under= =20 > the=20 > known memory locations. >=20 > > > and mayby a way to see if a var exists/is set >=20 > Ditto, RobC said no. Karl may add it to Bach. It's handy in mirc. But=20 > then,=20 > you can build your own var names in mirc while it's running, which is=20 > *very*=20 > handy.=20 >=20 > You can use associated lists (Jiri and others have written them), or you= =20 >=20 > could use pokes/peeks into memory (others have written those). Both=20 > approaches are likely much slower than if implemented in core Eu. The=20 > associated lists in Eu are faster than in mirc, especially if you wanna= =20 > wildmatch var names, such as: >=20 > 1) this.is.a.var.name > 2) this.is.also.a.var.name >=20 > varfind({this.is.*.var.name}) > wildfind({"var","name","this.is"}) >=20 > In mirc, this is=20 > wh=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF >=20
4. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by CoJaBo <cojabo at suscom.net> Jan 14, 2004
- 364 views
What on earth just happened to my message!?! "=20"s everywere! Why? CoJaBo wrote: > > > I don't see why Euphoria can't support at least the first two. > > A way to recvor from errors is almost absolutly nessescery in > programs=20 > that have a lot of user data when they might crash.(like Win32Lib IDE) > > Almost all other languages I've used had an "eval()" command, this > would= > =20 > be very useful in Euphoria. > > > Kat wrote: > >=20 > >=20 > > On 13 Jan 2004, at 22:52, CoJaBo wrote: > >=20 > > >=20 > > >=20 > > > Does anyone agree? > >=20 > > I agree, see notes below........=20 > >=20=20 > > > CoJaBo wrote: > > > >=20 > > > >=20 > > > > 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. > > > >=20 > > > >=20 > > > > "eval()" commands: > > > > I would really like to see a way to do an "eval()" type command. > > > > Many other languages have something like this. > >=20 > > RobC said no already, over and over, so Karl added it to Bach. Try it,= > =20 > > it's=20 > > plenty fast over any interpreter written in Eu in the archives. > >=20 > > > > _________________________________________________ > > > > Crash callback > > > > A way to setup a callback function would allow programs to save user= > =20 > > > > data before exiting > > > > with ex.err > >=20 > > I agree. Most do. RobC didn't. > >=20 > > > > set_crash(integer routine_id) > >=20 > > Ditto. > >=20 > > > > _________________________________________________ > > > >=20 > > > >=20 > > > > routine_id() for variables > > > > I would like to see a varible_id systym (like routine id) > > > > example: > > > > integer a,a_id a=3D3 > > > > a_id=3Dvar_id("a") > > > > ?get_var(a_id) > > > > --displays 3 > > > > set_var(a_id,4) > > > > --a now is 4 > >=20 > > Well, could be less complicated than that, but RobC said no, and Karl=20 > > has=20 > > said maybe (i think). If Eu used one byte per ascii char, this could be= > =20 > > more=20 > > useful than it would be now. It could be otherwise useful in dos32 semi- > > threaded apps if the app and var locations weren't paged out from under= > =20 > > the=20 > > known memory locations. > >=20 > > > > and mayby a way to see if a var exists/is set > >=20 > > Ditto, RobC said no. Karl may add it to Bach. It's handy in mirc. But=20 > > then,=20 > > you can build your own var names in mirc while it's running, which is=20 > > *very*=20 > > handy.=20 > >=20 > > You can use associated lists (Jiri and others have written them), or > > you= > =20 > >=20 > > could use pokes/peeks into memory (others have written those). Both=20 > > approaches are likely much slower than if implemented in core Eu. The=20 > > associated lists in Eu are faster than in mirc, especially if you wanna= > =20 > > wildmatch var names, such as: > >=20 > > 1) this.is.a.var.name > > 2) this.is.also.a.var.name <snip>
5. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by "Kat" <gertie at visionsix.com> Jan 14, 2004
- 384 views
On 14 Jan 2004, at 1:27, CoJaBo wrote: > > > I don't see why Euphoria can't support at least the first two. > > A way to recvor from errors is almost absolutly nessescery in programs=20 > that have a lot of user data when they might crash.(like Win32Lib IDE) > > Almost all other languages I've used had an "eval()" command, this would= > =20 > be very useful in Euphoria. I agreed=20 with=20 you!!=20 Please=45 explain=60 this=50to RDS!!=98 =74 =-3456.2 Kat=65 > Kat wrote: > >=20 > >=20 > > On 13 Jan 2004, at 22:52, CoJaBo wrote: > >=20 > > >=20 > > >=20 > > > Does anyone agree? > >=20 > > I agree, see notes below........=20 > >=20=20 > > > CoJaBo wrote: > > > >=20 > > > >=20 > > > > 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. > > > >=20 > > > >=20 > > > > "eval()" commands: > > > > I would really like to see a way to do an "eval()" type command. > > > > Many other languages have something like this. > >=20 > > RobC said no already, over and over, so Karl added it to Bach. Try it,= > =20 > > it's=20 > > plenty fast over any interpreter written in Eu in the archives. > >=20 > > > > _________________________________________________ > > > > Crash callback > > > > A way to setup a callback function would allow programs to save user= > =20 > > > > data before exiting > > > > with ex.err > >=20 > > I agree. Most do. RobC didn't. > >=20 > > > > set_crash(integer routine_id) > >=20 > > Ditto. > >=20 > > > > _________________________________________________ > > > >=20 > > > >=20 > > > > routine_id() for variables > > > > I would like to see a varible_id systym (like routine id) > > > > example: > > > > integer a,a_id a=3D3 > > > > a_id=3Dvar_id("a") > > > > ?get_var(a_id) > > > > --displays 3 > > > > set_var(a_id,4) > > > > --a now is 4 > >=20 > > Well, could be less complicated than that, but RobC said no, and Karl=20 > > has=20 > > said maybe (i think). If Eu used one byte per ascii char, this could be= > =20 > > more=20 > > useful than it would be now. It could be otherwise useful in dos32 semi- > > threaded apps if the app and var locations weren't paged out from under= > =20 > > the=20 > > known memory locations. > >=20 > > > > and mayby a way to see if a var exists/is set > >=20 > > Ditto, RobC said no. Karl may add it to Bach. It's handy in mirc. But=20 > > then,=20 > > you can build your own var names in mirc while it's running, which is=20 > > *very*=20 > > handy.=20 > >=20 > > You can use associated lists (Jiri and others have written them), or you= > =20 > >=20 > > could use pokes/peeks into memory (others have written those). Both=20 > > approaches are likely much slower than if implemented in core Eu. The=20 > > associated lists in Eu are faster than in mirc, especially if you wanna= > =20 > > wildmatch var names, such as: > >=20 > > 1) this.is.a.var.name > > 2) this.is.also.a.var.name > >=20 > > varfind({this.is.*.var.name}) > > wildfind({"var","name","this.is"}) > >=20 > > In mirc, this is=20 > > wh=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= > =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= > =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= > =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= > =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= > =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= > =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF > >=20 > > > > TOPICA - Start your own email discussion group. FREE! <snip>
6. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by CoJaBo <cojabo at suscom.net> Jan 15, 2004
- 368 views
I beleive that at least the first two should be added to Eu 2.5. Anyone else agree? Please take them 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=20 returns an error=20 code(like 5 for divide by 0,see below) Example: integer a,global_type sequence eval_commands eval_commands=3D" include incl_file.e--should allow including(This could be used=20 --instead of complex "dynamic includeing" libraries) if a then ?a end if" a=3D7 var_type=3D1 ?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=20 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,=20 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=3D34 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")) _________________________________________________ Kat wrote: >=20 >=20 > On 14 Jan 2004, at 1:27, CoJaBo wrote: >=20 > >=20 > >=20 > > I don't see why Euphoria can't support at least the first two. > >=20 > > A way to recvor from errors is almost absolutly nessescery in=20 > > programs=3D20 > > that have a lot of user data when they might crash.(like Win32Lib IDE) > >=20 > > Almost all other languages I've used had an "eval()" command, this=20 > > would=3D > > =3D20 > > be very useful in Euphoria. >=20 > I agreed=3D20 with=3D20 you!!=3D20 Please=3D45 explain=3D60 this=3D50to R= DS!!=3D98 > =3D74 > =3D-3456.2 > Kat=3D65 >=20 >=20 >=20 >=20=20 > > Kat wrote: > > >=3D20 > > >=3D20 > > > On 13 Jan 2004, at 22:52, CoJaBo wrote: > > >=3D20 > > > >=3D20 > > > >=3D20 > > > > Does anyone agree? > > >=3D20 > > > I agree, see notes below........=3D20 > > >=3D20=3D20 > > > > CoJaBo wrote: > > > > >=3D20 > > > > >=3D20 > > > > > Some of the following is missing from Euphoria and would be very > > > > > helpful to me and many other programmers. I would like to see thi= s in=3D > >=20 > > > > > Eu 2.5. Please take these into consideration. > > > > >=3D20 > > > > >=3D20 > > > > > "eval()" commands: > > > > > I would really like to see a way to do an "eval()" type command. > > > > > Many other languages have something like this. > > >=3D20 > > > RobC said no already, over and over, so Karl added it to Bach. Try it= ,=3D > > =3D20 > > > it's=3D20 > > > plenty fast over any interpreter written in Eu in the archives. > > >=3D20 > > > > > _________________________________________________ > > > > > Crash callback > > > > > A way to setup a callback function would allow programs to save u= ser=3D > > =3D20 > > > > > data before exiting > > > > > with ex.err > > >=3D20 > > > I agree. Most do. RobC didn't. > > >=3D20 > > > > > set_crash(integer routine_id) > > >=3D20 > > > Dit=FF=FF=FF=FF > > >=3D20 > > > > > _________________________________________________ > > > > >=3D20 > > > > >=3D20 > > > > > routine_id() for variables > > > > > I would like to see a varible_id systym (like routine id) > > > > > example: > > > > > integer a,a_id a=3D3D3 > > > > > a_id=3D3Dvar_id("a") > > > > > ?get_var(a_id) > > > > > --displays 3 > > > > > set_var(a_id,4) > > > > > --a now is 4 > > >=3D20 > > > Well, could be less complicated than that, but RobC said no, and Karl= =3D20 > > > has=3D20 > > > said maybe (i think). If Eu used one byte per ascii char, this could = be=3D > > =3D20 > > > more=3D20 > > > useful than it would be now. It could be otherwise useful in dos32 se= mi- > > > threaded apps if the app and var locations weren't paged out from und= er=3D > > =3D20 > > > the=3D20 > > > known memory locations. > > >=3D20 > > > > > and mayby a way to see if a var exists/is set > > >=3D20 > > > Ditto, RobC said no. Karl may add it to Bach. It's handy in mirc. But= =3D20 > > > then,=3D20 > > > you can build your own var names in mirc while it's running, which is= =3D20 > > > *very*=3D20 > > > handy.=3D20 > > >=3D20 > > > You can use associated lists (Jiri and others have written them), or= =20 > > > you=3D > > =3D20 > > >=3D20 > > > could use pokes/peeks into memory (others have written those). Both= =3D20 > > > approaches are likely much slower than if implemented in core Eu. The= =3D20 > > > associated lists in Eu are faster than in mirc, especially if you wan= na=3D > > =3D20 > > > wildmatch var names, such as: > > >=3D20 > > > 1) this.is.a.var.name > > > 2) this.is.also.a.var.name > > >=3D20 > > > varfind({this.is.*.var.name}) > > > wildfind({"var","name","this.is"}) > > >=3D20 > > > In mirc, this is=3D20 > > > wh=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3D > > =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3D > >=20 > > =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3D > >=20 > > =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3D > >=20 > > =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3D > >=20 > > =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3D > >=20 > > =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF= =3DFF=3DFF=3DFF=3DFF=3DFF=3DFF=3DFF > > >=3D20 > >=20 > >=20 > >=20 > > TOPICA - Start your own email=20 > > disc=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF= =FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF=FF
7. RE: "eval()" commands/crash callbacks/ect. for Euphoria 2.5?
- Posted by CoJaBo <cojabo at suscom.net> Jan 15, 2004
- 377 views
Okay, I'll try once more (Am I going crazy or are there "=##"s every were?!?): I beleive that at least the first two should be added to Eu 2.5. Anyone else agree? Please take them 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")) _________________________________________________ CoJaBo wrote: > > > I beleive that at least the first two should be added to Eu 2.5. > Anyone else agree? > > Please take them 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=20 > returns an error=20 > code(like 5 for divide by 0,see below) > > > Example: > integer a,global_type > sequence eval_commands > > eval_commands=3D" > include incl_file.e--should allow including(This could be used=20 > --instead of complex "dynamic includeing" libraries) > if a then > ?a > end if" > > a=3D7 > var_type=3D1 > > ?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=20 > 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,=20 > 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=3D34 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")) > > _________________________________________________ > Kat wrote: > >=20 > >=20 > > On 14 Jan 2004, at 1:27, CoJaBo wrote: > >=20 > > >=20 > > >=20 > > > I don't see why Euphoria can't support at least the first two. > > >=20 > > > A way to recvor from errors is almost absolutly nessescery in=20 > > > programs=3D20 > > > that have a lot of user data when they might crash.(like Win32Lib IDE) > > >=20 > > > Almost all other languages I've used had an "eval()" command, this=20 > > > would=3D > > > =3D20 > > > be very useful in Euphoria. > >=20 > > I agreed=3D20 with=3D20 you!!=3D20 Please=3D45 explain=3D60 this=3D50to > > R= > DS!!=3D98 > > =3D74 > > =3D-3456.2 > > Kat=3D65 > >=20 > >=20 <snip>