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

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

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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu