From: Bob Calco Date: 2002-09-07T11:36:37+09:00 Subject: RE: Larry Wall's comments on Ruby My $0.02... %% On Sat, 7 Sep 2002 05:20:22 +0900 %% "Denys Usynin" wrote: %% %% > > The published C++ FAQ book is about 4" thick, after all, so I %% > > submit that that language is actually FULL of surprises :-) %% > > %% > > /\ndy %% > > %% > %% > yeah and as I said, depending on your background , Ruby is %% just as full %% > of surprises as C++ is. %% %% Wow, I couldn't disagree more. Thinking about C++ templates alone makes %% my skin crawl. Well, I happen to like C++ and especially C++ templates for precisely the same reason I love Ruby: they make metaprogramming easy, in an otherwise hopelessly static language, no less. Templates in C++ are very powerful, and C++ syntax really isn't scary once you understand pointers and know how to use them and manage your own memory without blowing your foot off. Template syntax looks dangerous and even cabalistic until you know how to use templates for good design (Alexandrescu's "Modern C++ Design" is a work of sheer genius, for instance). Once you _do_ get into them, you can't program in C++ without them. Ruby's dynamic OO model provides another, simpler way to define high level abstractions in the aid of better program design, and is infinitely easier to refactor - which is a huge plus over compiled C++. I also like Ruby because, when I decide I need to, I can always extend Ruby in C++. So I get the best of both worlds, and can jaunt back and forth between them as the muse singeth. %% %% > My guess is Ruby won't surpise you too much only if you have %% Perl/Python %% > background. That's it. %% %% Coming from a perl background, I guess I can't answer this :-> Hmmm. You come from a Perl background and C++ template syntax makes your skin crawl... my $OK, $I_believe_you = shift( @_ ); ### ;) WRT Larry Wall's comments, they make perfect sense when you understand that he's got his own language to promote, and a new version soon, at that. My only comment is that Perl's retrofit of OO syntax is probably as ugly as anybody could have possibly imagined, and I think he did it that way because he really wanted it to look funky so that the people who "got it" and could use Perl OO productively would look superhuman smart, like him. Ruby's OO syntax, by contrast, is the definition of elegance and readability in a development environment (scripting) that really benefits from both (not that they aren't beneficial in _all_ programming environments, just that scripting is pointless if at the very least the syntax isn't much cleaner and noise-free than is possible in statically typed, compiled languages, like C++ - which continue to have their place in the world). Strictly speaking, Ruby's OOP is much closer to true OOP (elusive concept that it is!) than anything Perl has offered so far. And his whole notion that objects are too hard for beginners to grasp is the exact opposite of reality - its concepts like "scalars" and "fundamental data types" that throw off inexperienced programmers. Humans think in terms of objects or "things", and in particular we visualize reality in terms of objects, not in terms of the size of bytes of data that a computer can use. As sort of an aside, I do think that exposure solely to object oriented programming is a Bad Thing for the serious programmer, however: At some point he or she must look squarely at the ghost in the machine, turn on the light, and scare it away. There are other paradigms and they too can be good. But the casual programmer, like the casual citizen, can live a perfectly happy, productive life without direct knowledge of how the world really works, under the surface of things... That's actually the whole point of civilized society - to make primitive survivalism technically unnecessary - and the point of high-level languages as well: one should be able to get a lot of work-for-pay done in a high level language like Ruby without _necessarily_ having to know all the gory details of the implementation of dynamic typing, garbage collection, etc. Knowing these things of course is good: but not necessary for life. Sincerely, Bob Calco