RE: Danger! Type-checking & the translator

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

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.
> 
Yeah, that makes me real nervous.  As I said, that means I have to check 
not only all my own code but all libraries I want to use.  Is there a 
special reason it is unfeasible to have translated programs do type 
checking (if desired)?

Something should either be part of the language or not.  Whatever you 
think of my algorithmic choices, they should at least work consistently, 
regardless of what "most people" may or may not be doing.

> 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...
> 
>

No problem with coding around this stuff, but the code isn't as clean. 
(And my name ain't Pete.)


-- Andy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu