Re: Danger! Type-checking & the translator

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

ACK!!!

I'm writing an exceptions lib, which would allow you to catch almost every
possible runtime error via eu_errno, rather than crashing. (I.e., using
e_puts() instead of puts(), e_close() instead of close(), op_eq() instead of
'=', op_gr() isntead of '>', etc, would catch errors and set eu_errno,
instead of letting the interpreter barf.) Its nowhere near complete however,
(only a few functions and already nearing a thousand lines! the thing, when
finished, will probably be HUGE!!!), what it does to attempt to catch type-
check errors, is always return true, but to set eu_errno, so the program can
catch the type check error in the code, after the variable has been assigned
to.

Apparently it'll be useless for the translator, however.

disappointed,
jbrown

On Tue, Jan 28, 2003 at 09:35:11AM +1100, Patrick.Barnes at transgrid.com.au
wrote:
> 
> >From Robert Craig:
> >Type checking is meant to be used for catching errors,
> >and for debugging. I wouldn't recommend using it as
> >an integral part of your algorithm. 
> 
> Ummm, it can't catch errors if it's not used, I would think...
> The use of custom types is a valid way of programming, and having an
> interpreter and a translator looking at the code differently is an 
> error, no matter how you justify it.
> 
> Ok, to type check custom types every time a value is assigned is going
> to slow things down a little, so perhaps if the programmer explicitly declares
> 'with type_check' then it will...
> 
> Also Pete, each of your instances of
> 
> type db_error(integer s)
> 	if 
> 	---stuff
> 	return 1
> end if
> 
> err = db_function(arg, arg2, arg3)
> 
> could be replaced with
> 
> type db_error(integer s)
> 	if 
> 	---stuff
> 	return 1
> end if
> 
> if db_error( db_function(arg, arg2, arg3) ) end if
> 
> 
> or something similar...
> 
> 
> ***********************************************************************
> 
> 
> ***********************************************************************
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!

-- 
 /"\  ASCII ribbon              | 
 \ /  campain against           | Linux User:190064
  X   HTML in e-mail and        | Linux Machine:84163
 /*\  news, and unneeded MIME   |

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

Search



Quick Links

User menu

Not signed in.

Misc Menu