Hi,

In message "[ruby-talk:18931] notes from a Ruby newbie"
    on 01/08/01, Ned Konz <ned / bike-nomad.com> writes:

|There are no post- or pre-increment or decrement operators!

No.  Because I couldn't give them object-oriented semantics.  They
would be essentially assignments.

|There's nil? but no notNil? Why? I realize that there's unless and until... 
|(yes, I know I can make my own).

No paticular reason, except A) I don't like Smalltalk-ish naming
convention, e.g. "nonNil?" B) we already have not/unless/until, so "if
a.notNil?" is fundamentally same as "unless a.nil?";  I felt we don't
need this one.

|How do I display the current line context in debugger? The only way I've 
|found is to display the call stack and then specify an explicit line number 
|to "l". Would be nice to have a short-cut to specify "show me the current 
|line". Perhaps "l ."

use rubydb.el, if you're Emacs user.  It works just like gdb-mode for
Emacs.

|How do I get vi mappings in the debugger? It tells me that emacs mode is 
|available... I got vi mappings going in irb.

"emacs mode" here means that you can run it under Emacs using
rubydb.el.  But since the debugger uses readline, which provides vi
binding, I think you can get vi binding (I've never tried).  Check out
GNU readline document.  I think you have to configure your ~/.inputrc
file.

|Is there a standard equivalent of perldoc for Ruby? I'm used to having a 
|standard command to get module documentation; there seems to be no standard 
|way to find module documentation in Ruby. Yes, I've seen rdtool, but it 
|doesn't seem to be integrated with anything. And 3rd-party modules don't 
|install their documentation in a standard place, since there isn't one.

"ri" can serve for you.  It's online version of the reference section
in the pickaxe book.  Fetch it from 

      http://www.pragmaticprogrammer.com/ruby/downloads/ri.html

|There doesn't seem to be a standard way to install 3rd-party modules in Ruby 
|that works as smoothly as CPAN.pm.

Not yet.

|"responds_to?" probably makes more sense to English speakers than 
|"respond_to?".

Maybe.  But I'm Japanese.  Ruby is not English.  It's the basic naming
rule to avoid third person singular form in the standard libraries.

  you = Human.new
  if you.respond_to?(:knock)
    ...
  end

  buddies = member.collect{|x| x.friend_of?(me)}
  buddies.respond_to?(:select)

|---------
|a = 0
|a ||= 3
|doesn't work but doesn't complain. Even though:
|a.respond_to?('||=')  returns false. Why doesn't it complain?

Because it's not a method.  Abbreviated assignment (argumented
assignment) is combination of operator and assignment.  In addition,
"||" is not a method neither.  See page 220 of pickaxe book.

|Surprise! 0 isn't false, but the ||= operator doesn't complain about the 
|non-Boolean receiver like it would in Smalltalk.

Because it's true.  Everything but false nor nil is true.

|p = Proc.new { |a| a }
|p.call(1, 2)      # => [1,2]
|
|Surprise! The list turned into an Array!
|
|I would have either expected a warning or the second parameter to be ignored.

Ah, it will be solved in the future.  For now, you have to use

  p = Proc.new{|a,| a}       # notice "," after "a"

to specify single parameter to the block.  {|a|..} works like
{|*a|..}, if multiple arguments are passed to the block.

|If you call a method with the wrong number of arguments, you get an error 
|message. But not a Proc.

Proc does check number of arguments, e.g.

  p = Proc.new{|a,b| p [a,b]}
  p.call(1)	# error!

But as I explained before, you have to specify "a," for single
parameter to enable argument number check.

							matz.