Re: Structures; etc.
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 30, 2000
- 492 views
On Sun, 30 Jan 2000, you wrote: > I think the best way to go would be to use a pre-processor. This would > allow the interpreter to stay small and fast, and it would not require > any modification. It would also let people choose from a variety of > pre-processors, or write one themselves, so they can decide on the style > they like. Pretty much out of the question - we would still be using the type() function. Try this program: atom start type byte (object x) if x < 0 or x > 255 then return 0 else return 1 end if end type byte x start = time() for i = 1 to 10000000 do x = 5 end for ? time() - start -- takes avg. 4.51 seconds integer y start = time() for i = 1 to 10000000 do y = 5 end for ? time() - start -- takes avg. 0.54 seconds You can see that user-defined types are useless except for debugging purposes, as the overhead kills any performance whatsoever. This is for a single type check. I haven't even tried nested type checks. Any pre-processor would either have to let everything go untyped, or rely on the type() function. Neither is acceptable. This functionality needs to be built into the language itself. Irv