On Tue, May 13, 2003 at 10:54:09PM +0900, KONTRA Gergely wrote: > On 0513, nobu.nokada / softhome.net wrote: > > > Than why not sin is a method? > > To fit to mathematical notation. > ??? > I write sin(0.5) but also abs(0.5) > So I don't know why the difference, and why cannot a number tell it's > sin. This is analogous to "asdf".length and the others... > > > > And puts? > > puts is a method of IO class. > > STDERR.puts "asdf" > > Or you can use Kernel#display. > > "asdf".display(STDERR) > Again confusing for me... > Which approach uses ruby? > IO.puts(what) or what.puts(IO=stdout) and why it is not consistent. > The string displays itself, or the filehandle displays the string? anObj.display(io) will internally invoke io.puts(anObj) So, a string uses an IO object to display itself. > Or has ruby a habit in the core and not a concept? You'll see that Ruby has a concept, once you've get into it more deeply. > Another ugliness in the syntax, which bothers me is the @ and @@ (and > will be @@@ ??) notation, which I think doesn't fit into the view. > Does anybody know the root of it? Forget Perl! $xxx and @xxx have a completely different meaning in Ruby than in Perl. - $xxx are global variables - @xxx are instance variables - @@xxx are class variables - local variables do not have a prefix - variables that start uppercase are constants I like $ and @ very much, as it allows you to distinguish quickly which variables are globals, which are instance variables and which are locals. In C/C++ or Java you cannot determine this without looking at the definition, which may be hundreds of lines away. Regards, Michael