From: mirian@... (Mirian Crzig Lennox) Date: 2001-06-16T04:19:39+09:00 Subject: [ruby-talk:16506] Re: Playing with Ruby Syntax (was: Initial thoughts about Ruby From a Smalltalk Programmer) In article , Dave Thomas wrote: > >However, some folks feel that this is getting too close to >Smalltalk. I'm not sure I see why that's a valid objection, but I'd >like to see it discussed. This may be a bit of a tangent, but I've recently noticed that Ruby's syntax can be remarkably like C, Lisp and reversed Forth, depending on one's inclination, to a degree I wouldn't have previously imagined... for example, if 'foo' and 'bar' are methods, and 'x' is some variable, you can express: foo(bar(x)) # looks like C (foo(bar x)) # looks like LISP foo bar x # looks like Forth (read right to left) What I find interesting about it is that Lisp and Forth have extremely simple, yet powerful syntaxes. And as such, in both languages, even keywords like "if" and "while" can be thought of not as special constructs only understood by compilers, but just functions like any other functions a user might write. So, one perverse thought I had is that, in Ruby, a construct like if condition ... end is not syntactically much different from obj.each do ... end so why not just make 'if' be a method, just as obj.each is? And maybe other keywords as well. Thus, customizing keywords or adding keywords is just a simple matter of adding or redefining methods, just as it is in Lisp or Forth. --Mirian