From: Dan Sugalski Date: 2002-12-18T00:55:06+09:00 Subject: Re: help -- persuade my boss to adopt ruby At 3:09 PM +0900 12/17/02, Bulat Ziganshin wrote: >Hello Dan, > >Monday, December 16, 2002, 11:59:25 PM, you wrote: > >>>concrete, i feel that Ruby is not strict enough and can't be compiled >>>for more or less fast execution. > >DS> This is very much incorrect. >DS> This is a *very* non-trivial thing to do, > >yes, i mean exactly that I don't, though--you cut out some interesting bits in the middle. And you also completely missed the point of this: >DS> Dynamic typing also has a number of advantages that make it better >DS> suited for several classes of problems than a statically typed >DS> language such as C or Java. The cost that dynamic typing imposes is >DS> the price you pay for that better suitability--it's an engineering >DS> tradeoff like any other, as no feature is free. If you want the dynamicity of Ruby, the speed is something you live with, and if you want much of a speedup (beyond, say, a factor of three or four) it's a lot of work. If you *don't* want the dynamicity of Ruby, why bother arguing? Without that dynamicity, Ruby's not that much different than any of a dozen other languages. >i think that 90% of declarations may be statically typed and this give more >robust and self-commenting code. In my experience it doesn't. Static typing protects you from errors that you just never make (it doesn't even do much for that dolt down the hall that you wish would have a horrible keyboarding accident and never code again), and it very much gets in the way--it's one of the reasons collection classes are so much of a pain in statically typed languages. Partial typing is of no use for speedups. The only way to get an easy speedup is to go fully-typed and forbid runtime method redefinition. Partial typing is *also* of no use for compile-time catching the errors you're looking to catch. (ignoring the fact that those errors just aren't made) There's no guarantee that those signatures will be valid at runtime, and if that's the case they aren't of any use. About the only place that signatures are useful is if you have multimethod dispatch, where you have multiple methods with the same name and different signatures and dispatch based on the signature, but that's not what you've been talking about, and it's been done to death in the past. This would probably be the place where you'd either start arguing that I'm wrong in the above statements, or that adding in optional redefinition forbids along with the type definitions in the signatures and types on the variable declarations would be a good idea. I'm not, and they aren't for ruby. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk