Re: "OF" in types, yet again...
- Posted by Robert Craig <rds at RapidEuphoria.com> Jul 03, 2004
- 478 views
Patrick Barnes wrote: > > Sorry... the attachment was stripped out. > It can be found here: <a > href="http://users.secsme.org.au/~prbarnes/misc/oth/of.zip">http://users.secsme.org.au/~prbarnes/misc/oth/of.zip</a> > RobC, any comments? > > On Sat, 3 Jul 2004 11:22:10 +1000, Patrick Barnes <mrtrick at gmail.com> > wrote: > > > > > > At the suggestion that I implement a test system to show how effective > > the "of" type can be, I have done so.... > > > > Run benchmarks.ex to see how it performs on your machine. > > To change the number of iterations, change constants.e. > > > > "of" is at least 20 times faster at 10,000 records. > > > > Everyone, what do you think? See test_of.ex for example. > > -- > > MrTrick Thanks, I downloaded the zip and took a quick look at it. I have no technical problems with implementing something like this. As I said, I studied this in great detail a few years ago. It's a logical and elegant extension to the language. I would not restrict it to one-level of slice or force the new syntax to appear only within a type declaration. e.g. I would allow an infinite number of levels: sequence of sequence of ... <type> x Of course people will naturally demand a way to declare structures and add them to the type system. e.g. sequence of mystruct x I don't need a benchmark to show me that type checking one (subscript) or a few (slice) elements will be much faster than checking the whole sequence. The only thing holding me back is that I doubt many people would use this, and those that would use it would not benefit greatly from it. I can't see many people bothering to say: sequence of sequence of integer s when they can just say sequence s I've found that most people are more interested in how few keystrokes they can type to get the job done, than they are with adding extra type-checking, especially with all the run-time checking that Euphoria already has. Beginners would have to read a big new section of the manual describing all these wonderful types that they can create. They would falsely conclude that this was an essential part of the language, without which you can't do anything, just like C++ or most other statically-typed languages. In Euphoria, types are for documentation and debugging. Period. They are not used to construct data structures, like in most other languages. Thus they are not central to the language, like they are in most other languages. I wouldn't want to add a lot of fancy extensions to something that isn't very important. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com