On Sat, Sep 28, 2002 at 05:45:41AM +0900, William Djaja Tjokroaminata wrote:
> Exactly.  At this point, there is nothing fundamentally changed regarding
> Ruby.  Just like "attr_reader :a" is only a shortcut for
> 
>     def a
>         return @a
>     end
> 
> the new syntax "def func (Float a, String b, Fixnum c)" is only a
> shortcut for
> 
>     def func (a, b, c)
>         raise "type error" unless a.kind_of Float
>         raise "type error" unless b.kind_of String
>         raise "type error" unless c.kind_of Fixnum
> 
> I think, at least with this new syntax Ruby will become more friendly to
> people with strongly-typed language background, while it may save some
> typing for the Ruby programmers themselves, if indeed we need to check the
> class of an input.  (Hey, with very simple thing like this I guess I can
> just put it in my own personal translator; this is even easier as class
> name should start with an uppercase while the variable with a lowercase.)

But all you're getting is "type error" instead of another description.
It could eventually help you discern where the error was, but the
application won't run better.

> Now, if we want to go further by also checking later when a, b, or c gets
> new assignments, that is a different story.  The Ruby parser needs to be
> modified (but not the Ruby fundamental object model nor its internals at
> all).
> 
> Regarding sugar, I think Matz has said that Ruby is not a minimalist
> language; we have both "if" and "unless".  Then of course, the sugar-level
> propensity of each person is different :)

I used to love C's reduced set of reserved words. I thought I'd hate
syntactic sugar, for I had used Pascal and it was far too verbose (I
didn't clearly see the difference between verbosity and sugar at that
time). Then went through several languages before finding Ruby, and now
I must say I do absolutely love to have some sugar :-)

OTOH I wouldn't like Ruby to end like Perl:
	"there's 243 ways to do it"
and having 5 syntactic variations for each one.

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
  
'Ooohh.. "FreeBSD is faster over loopback, when compared to Linux
over the wire". Film at 11.'
	-- Linus Torvalds