From: bbense+comp.lang.ruby.Apr.22.02@... Date: 2002-04-22T23:53:16+09:00 Subject: Ruby as Smalltalk -----BEGIN PGP SIGNED MESSAGE----- In article <001c01c1e8d4$0290f650$0100a8c0@backpack>, Nat Pryce wrote: >> How would you say Ruby is compared to Smalltalk? > >About three quarters :-) > >Smalltalk allows the programmer to define both data and control >abstractions. Ruby allows the programmer to define data abstractions and >some control abstractions. However, user defined control abstractions in >Ruby are limited to iteration and callbacks; it is hard to implement choice >control abstractions using Ruby blocks because a method can only have one >block. - - This seems to be the main critism of ex-smalltalkers when they first look at Ruby. However, you can implement all those hoopy control abstractions in Ruby, you just have to use Procs rather than blocks. You can pass an arbitrary number of Procs to a method. - - Blocks are just a shortcut to handle the most common case in an efficent manner. It is a bit awkward that you have to use different syntax ( foo.call vs. yield ). It seems to me that this bit is one of the difficult things to master about Ruby. Blocks are syntax, not objects. If you need an object use Proc. - - Booker C. Bense -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBPMQgRAD83u1ILnWNAQEyMQP7BNdWimCfqVRfFnLSxpSrtNZuudc5MUD7 WsaZyHRP5opXYAKKRjZ9B0mmZ7rxd3bxW/RjmZWa+YNRuFRHSS8iD3FAJK4XTj/n unTWsROk8/4ePaUpUUUQJxMjX3U1Y2SYqtuW7atD17SAfOgMe0XZBTeNk6FE8gIb 1kXNydQsw5w= =CagJ -----END PGP SIGNATURE----- --