Re: Eu's poor design(Irv)
- Posted by Juergen Luethje <j.lue at gmx.de> Aug 18, 2003
- 385 views
Jim wrote: > On Sun, Aug 17, 2003 at 08:28:00AM -0700, eugtk at yahoo.com wrote: <snip> >> Speaking of arrays, it's pretty well accepted that >> arrays of characters (AKA "strings") are also useful >> in computer programming. So how do you tell Eu to >> create a variable that *must* be a string? Not one >> that could be a string, or might just as easily be an >> array of coordinates, or a list of pointers to C >> routines ? > > Another flaw. OE will have a char type and the keyword "string" will mean > the same thing as "sequence of char". I also regard a "string" aka "sequence of char" type as desirable and very useful. So what is a "char"? Traditionally, this is an integer in the range [0,255]. But I think a programming language nowadays should handle Unicode strings as well. So will OpenEu also have a "uni_string" aka "sequence of uni_char"? <snip> >> 2. What's worse, even after you have written that >> complex type-checking routine, once you detect an >> invalid assignment, there's nothing you can do about >> it >> except to crash! Wasn't it QBasic that had a >> "redo-from-start" error message that at least let >> you try again, rather than losing your work? > > Well, you could make the type-check routine set a flag and return true > (i.e. pretend its ok but give set a warning so later code can fix it) but > thats a bit ugly. IMHO it's much cleaner to use what IIRC is called "explicit type-checking": --------------------------------------------- type foo (object x) return integer(x) and (x < 327) end type atom data data = <whatever> if not foo(data) then <handle this error however you want> end if --------------------------------------------- <snip> Regards, Juergen -- The difference between men and boys is the price of their toys.