From: Nick Van Weerdenburg Date: 2004-04-28T05:41:18+09:00 Subject: Re: How's ruby compare to it older brother python Oh please, no {}s. "end" is one of the things I love about Ruby. There is some awesome discussions out there on Python vs. Ruby that people provided links to. They are a great catalyst for language philosophy and design discussions, since the languages are so close yet so different. Unfortunately, I'm now trying to also learn Smalltalk, Lisp, Scheme, and Haskell. Hyperlinks are evil! Nick On Apr 27, 2004, at 1:12 AM, Jean-Hugues ROBERT wrote: > At 03:29 27/04/2004 +0900, you wrote: >> "Phil Tomson" wrote in message >> news:c6jg7404m@enews4.newsguy.com... >> > In article <108pvmgl0h7m3ea@news.supernews.com>, >> > John Roth wrote: >> > > >> > >"Hunn E. Balsiche" wrote in message >> > >news:c6ich0$c5mee$1@ID-205437.news.uni-berlin.de... >> > >> in term of its OO features, syntax consistencies, ease of use, >> and >> their >> > >> development progress. I have not use python but heard about it >> quite >> > >often; >> > >> and ruby, is it mature enough to be use for developing serious >> > >application, >> > >> e.g web application as it has not many features in it yet. >> > > >> > >As another poster has mentioned, Ruby is more closely related >> > >to Perl than to Python. While I don't use it, people I respect who >> > >have moved to Ruby say it has a couple of real killer features; >> > >in particular the way blocks and the pervasive use of the visitor >> > >pattern come together change the way one writes programs for >> > >the better. >> > > >> > >As far as syntax is concerned, there doesn't seem to be a >> > >huge amount of difference. Syntax is syntax, and every language >> > >has it's little pecularities. >> > >> > Well, there is one big difference syntactically: Python uses >> indentation >> > as syntax and Ruby doesn't. Personally I don't prefer Python's >> > 'indentation-as-syntax' since it means that syntactically >> significant >> > pieces of my code are invisible and if the tab settings in my >> editor are >> > not the same as yours it can make it difficult to share code (or >> even >> > worse, it might look like everything is OK when we share code, but >> the >> > code which looks exactly the same to each of us, might not be >> depending >> > on how tabs are or are not expanded). It would also seem to be a >> pain for >> > cutting & pasting code as well. >> >> As I said in another post, indentation is the reason I learned >> Python in the first place, but it's not the reason I stay with >> the language. In fact, I've come to the very heretical view >> that the indentation sensitivity is a language design mistake. >> It should be the editor's job to handle that level of detail in >> a manner that the developer finds workable. >> >> One reason I think it's a language design mistake is that >> it's not recursive. That is, it's not possible to shift from >> expression level indentation back to statement level >> indentation without major disruptions. This is needed for >> embedded blocks. >> >> I think Ruby has a reasonable middle ground here: its use of >> 'end' is fairly unobtrusive compared to, for example, C, C++, >> C# or Java. Even so, I think that a reasonable programming >> editor would get them out of my face while I was programming. >> >> The tab issue is one of those relatively inconsequential things >> that people seem to love to argue about: I'd rather be able to >> tell the editor how I want the program formatted, and have done >> with it. > > I totally agree. > > But if your editor cannot manage "end" and indent for > you, at least your pretty-printer can. I find it a great > consolation to tailor my pretty-printer to display the > code with my preferred syntax/style. > > As an example, mime transforms hash of symbols to display them > using Ruby 2's syntax: > { :a => "1", :b => "2", :c => "3"} is displayed as: > { a: "1", b: "2", c: "3" } > I get today some of the benefits of tomorrow ;-) > > For as unobtrusive as it is today, "end", is still something > that annoy some people (not me). It is a shame that {} cannot be used > instead because supporting {} would attract more people to Ruby than > any other feature (my guess) ! > > In addition to indentation and closing blocks, a decent editor should > handle folding (more and more frequently done) and hiding (filtering > out > some part of the code, comments for example). > > I still wonder why most editors don't try to guess my indentation > style (which is of 2 chars) looking at the code (an either using > the code's style or my imposed one, that way tab could stay 8 as > ANSI defined). > > Jean-Hugues > >