Re: Type checking
- Posted by Robert Craig <rds at RapidEuphoria.com> Aug 10, 2002
- 464 views
Pete Lomax writes: > I had something like > > integer a,b,c > sequence x,y,z > > & stupidly put ",text" at the end of the first line not 2nd. > > The line text={} blew up when it ran, but I was surprised it didn't > blow up when the interpreter first loaded it. > > How much overhead would it cause to add simple checks during load? > Do bind, shroud, or euphoria to C perform such checks? Bind and shroud know almost nothing about the type of data you are using. They do very little error checking of any kind. The interpreter and translator share the same "front-end". That front-end concentrates on syntax and variable-not-declared sorts of errors at "compile-time". I could add lots of extra special-case compile-time error checking in the front-end, for instance catching your text={} statement, but not catching more general statements. There would be value in catching errors earlier, and in some cases the offending code might be in a statement that is rarely, if ever executed, so you'd be happy to be told about the problem. I've been tempted to add more error checks like this, on an ad-hoc basis, but the fact that these checks are semi-redundant with equivalent run-time checks, has made me feel it's not worth the trouble. If I start doing it now, it could break existing programs. e.g. some useful library has a bug in a statement that's only executed in a rare error-condition, but the novice Euphoria user gets a compile-time error and gives up. Just giving a warning would seem rather timid, given that the statement can't execute at all. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com