From: Todd Benson Date: 2008-04-16T02:46:22+09:00 Subject: Re: Ada vs Ruby On Tue, Apr 15, 2008 at 12:25 PM, framefritti@gmail.com wrote: > Interesting thread... also because I use both Ruby and Ada. No, > better... > since I _love_ both Ruby and Ada. Yes, they could not be more > different and... > no, I do not have any split-personality problem (at least, non that I > am > aware of it...:-) > > In my personal experience, they are both great languages and each one > "shines" > in its field. I use Ruby for small to medium-large applications where > "duck > typing" allows you to write good and flexible software in little > time. However, > I discovered that when I go to large to very large applications, a > pedantic language > as Ada (which would not allow you to write sqrt(5) because "5" is an > integer and > not a float... my first Ada program...) is a better choice since many > errors > are caught at compile time and many others just at the first few runs > by the > checks automatically inserted by the compiler. For example, if you > write > > type Month_Day is new Integer range 1..31; > > MD : Month_Day := 30; > > MD := MD + 3; > > you will get a runtime error because MD exit from the allowed range. > In C this bug could comfortably sleeps for centuries... > > Moreover, if you define > > type Counter is new Integer; > > Ada strong typing will prevent you to assign a value of type Month_Day > to > a variable of type Counter (the magic word is "new") and this makes a > lot > of sense, unless in your application you can convert a day into a > counter. > I discovered that when your software grows larger, this kind of > constraints > that you _ask to the compiler_ to enforce on you, can really help. > [there > are *lots* of discussion about the usefulness of the introduction of > new incompatible types. The sentece above is just my opinion, > based on some personal experience. I hope I did not open a new > can of worms...] You can "type" your variables in Ruby if you have to. I don't think that's the problem. It's the possibly reckless meta-programming in libraries you use (I'm not talking about you, Trans, I think Facets is great). Being an engineer and a db guy, you would think that Ruby is the most god awful thing I've ever seen. Well, it has its place. For realtime, Michael is right about the "time of execution" being _the_ important thing. I would like to see in the future, however, a Ruby that talks to the hardware like RTLinux or QNX. I'd take up such a project myself, except I don't know enough C or assembly. I suppose you'd have to make certain objects allowed to have free reign over the processor/memory. Like an Object#become_real, though that's a little scary :) Todd