From: Michael Sullivan Date: 2002-04-23T05:44:55+09:00 Subject: Re: Ruby as Smalltalk Not to start a flame war, and a "my language is better than your language" debate. Somehow this all reminds me of people writing C macros to program C as though they were programming in Pascal. I forget where I heard the quote: "If you want to code in C, code in C. If you want to code in Pascal code in Pascal. But, don't make you C look like Pascal and your Pascal look like C." I'm sure if one tried enough one could make Ruby look like COBOL (or Java), but why? :) Mike #define begin { #define end } #define true 1 #define false 0 On Tue, Apr 23, 2002 at 05:12:10AM +0900, Paul Brannan wrote: > On Tue, Apr 23, 2002 at 12:19:43AM +0900, Nat Pryce wrote: > > E.g. in Ruby a user defined control structure if-then-else block would look > > like this, which is more awkward than the built in if statement: > > > > if some_test proc do > > something > > end, else proc do > > something_else > > end > > This seems very awkward to me, much more so than passing two procs to a > single method. I didn't even realize this syntax was legal. > > > While in Smalltalk it would be: > > > > some_test ifTrue: [ > > something. > > ] > > ifFalse: [ > > something_else. > > ]. > > If syntax is what you are after, consider this (just for fun; I don't > know if this is reasonable for production code): > > It seems to me that this would be much slower than the standard > if/then/else/end, since so many method calls are involved. In > Smalltalk, it looks like only one method call, but it still looks like a > method call. How does Smalltalk make its ifTrue:/iFalse: work at a > reasonable speed? > > Paul > -- Michael P. Sullivan Distributed Computing Systems, LLC Cell: 516-429-2080 E-Mail: mps@discomsys.com http://www.discomsys.com/ * UNIX Systems and Database Consulting, Architecture and Management * "Failing to plan, is planning to fail... plan for the worst, hope for the best"