From: Chad Perrin Date: 2007-03-11T04:35:17+09:00 Subject: Re: A couple of questions from a Ruby neophyte On Sat, Mar 10, 2007 at 09:15:05PM +0900, Lawrence Oluyede wrote: > Chad Perrin wrote: > > If you've ever noticed the way OOP characteristics look bolted-on in > > Perl, you might understand how regex support looks bolted-on in Python. > > For one thing, regex support is provided only through a library, rather > > than as part of the core language -- in other words, it really *is* > > bolted on. > > That's maybe a deficiency in language design but I don't think the > Python's regex support is worse because of that. The 're' module > is very comprehensive and > it's object oriented. The matching objects are _objects_ indeed. Ruby > does have regexp support builtin but hey, there must be some differences > between the languages or we won't be here to talk about those :-) It may not be worse internally, but it's more annoying to use -- and really, the important bit for language design is how we end up having to use it. The principles of OOP actually support me in this: I shouldn't care about the internal workings of Python's regex engine as much as the interface through which I use it. If the interface sucks, it sucks; if the interface is good, it's good. > > > You might want to judge Ruby syntax on something other than a > > demonstration of irb. > > I agree. My first taste of Ruby syntax was not really that good but > after a couple of more bites I really enjoyed the meal and there are > cases where I find Ruby to cleaner than Python. I've come to believe that Ruby and Python probably have equivalently clean, elegant syntax -- but one or the other may look more or less clean and elegant, depending on personal taste, and depending on the specific bit of code you're writing. Overall, I find Ruby more readable than Python, but then I find Python's reliance on whitespace to define blocks (in the generic, non-Ruby sense of the term "blocks") of code somewhat less conducive to readability than the way Ruby lends itself to being written. It's probably just a personal thing. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] "There comes a time in the history of any project when it becomes necessary to shoot the engineers and begin production." - MacUser, November 1990