[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02957] Re: Things I am wondering...

From: matz@... (Yukihiro Matsumoto)
Date: 2000-05-24 04:56:22 UTC
List: ruby-talk #2957
Hi,

In message "[ruby-talk:02954] Re: Things I am wondering..."
    on 00/05/23, "David Douthitt" <DDouthitt@cuna.com> writes:

|>|1. Why is Dir::foreach not named Dir::each? 
|>
|>`each' is reserved for default enumeration.
|
|What is "default enumeration"?

Well, the name 'each' is used by for statement and Enumerable module
to iterate over container's each items.  For example, simple for
statement

  for i in array
    ...
  end

is implemented by

  array.each do |i|
    ...
  end

So I wanted to reserve the name for the purpose.  The class Dir is not
a container (the instance of Dir is).

|I could see wanting to expand Boolean, and having True and False there would be nice.

Possible.  I'll add this to ToDo file.  But remember, the values true
and false are merely representative values for conditional value.  All
non-nil, non-false values are truth value in Ruby.  Introducing
Boolean class may be the cause of confusion.  I think more discussion
is needed before add it to Ruby.

|To flip-flop the question: what is the rationale for "and" "or" et al?
|Isn't "&&" and "||" enough? :-)

Functionaly enough.  They are mere aliases.  Lower precedence logical
keyword operators are inspired by Perl.

  unlink "a", "b", "c" or raise "error!"

Can be written as follows using || operator:

  unlink("a", "b", "c") || raise("error!")

							matz.

In This Thread

Prev Next