What do you think about Ruby ?
Jim Menard
jimm at io.com
Sun Aug 7 13:31:01 UTC 2005
Blake wrote:
> On Sun, 07 Aug 2005 04:50:35 -0700, Damien Cassou <cassou at iam.unibe.ch>
> wrote:
>
>> You all answer the same way, you are all poet. But nobody answer the
>> question :
>>
>> What are the "technical" differences ?
>
>
> It's a broad question. I answered part of it, which is that Ruby uses
> traditional language constructs to avoid the conceptual difficulty some
> people have in adapting to a straight "object message" syntax. In other
> words, the "foreign" construct of:
>
> 1 to: 4 do: [:i | Transcript show:i].
>
> in Smalltalk is replcaed by:
>
> i = 0
> begin
> puts "#{i}"
> i += 1
> end until i > 4
What? In Ruby, I'd write either
4.times { | i | puts(i+i) }
or perhaps, using the Range class,
(1..4).each { | i | puts i }
> Perl is Ruby's other big influence.
Less so every major release. The use of magic variables like $: and $_ are
strongly discouraged in Ruby. All of the Ruby books I'm familiar with
encourage decent (non-Perl) programming styles. You can write "procedural"
scripts, but they are really OO scripts that call methods on a
magically-created "main" object that inherits from Object and mixes in the
Kernel module.
Yes, Ruby isn't image based. That's one reason I like it: I can use Emacs.
Jim
--
Jim Menard, jimm at io.com, http://www.io.com/~jimm
More information about the Squeak-dev
mailing list
|