[#4766] Wiki — "Glen Stampoultzis" <trinexus@...>

21 messages 2000/09/04
[#4768] RE: Wiki — "NAKAMURA, Hiroshi" <nahi@...> 2000/09/04

Hi, Glen,

[#4783] Re: Wiki — Masatoshi SEKI <m_seki@...> 2000/09/04

[#4785] Re: Wiki — "NAKAMURA, Hiroshi" <nakahiro@...> 2000/09/05

Howdy,

[#4883] Re-binding a block — Dave Thomas <Dave@...>

16 messages 2000/09/12

[#4930] Perl 6 rumblings -- RFC 225 (v1) Data: Superpositions — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/09/15

[#4936] Ruby Book Eng. translation editor's questions — Jon Babcock <jon@...>

20 messages 2000/09/16

[#5045] Proposal: Add constants to Math — Robert Feldt <feldt@...>

15 messages 2000/09/21

[#5077] Crazy idea? infix method calls — hal9000@...

This is a generalization of the "in" operator idea which I

17 messages 2000/09/22

[#5157] Compile Problem with 1.6.1 — Scott Billings <aerogems@...>

When I try to compile Ruby 1.6.1, I get the following error:

15 messages 2000/09/27

[ruby-talk:5117] Re: Types and ===

From: Yasushi Shoji <yashi@...>
Date: 2000-09-26 00:23:18 UTC
List: ruby-talk #5117
From: hal9000@hypermetrics.com
Subject: [ruby-talk:5114] Types and ===
Date: Tue, 26 Sep 2000 08:40:01 +0900

> Reason with me: Normally when x == y, x === y is also true (I'm
> not saying the converse!!). But I have found a case where it isn't.
> I can see there may be others.)
> 
> See the fragment below, and its output.
> 
> classify1 and classify2 don't do the same thing. The first fails;
> the second works. classify3 also works.

ahm... I might be missing something.  You said '*Normally* when x ==
y, ...', and also you said you know '==' is not '===' but assuming
Module#=== is equal to Module#== ?

try this:

o = Object.new
p (Object === o)
p (Object == o)

"Object === o" is equal to "o.is_a? Object".  that makes easier to
write case statement.

def classify4(arg)
  case arg
    when String
      print "  arg is a string\n"
    when Array
      print "  arg is an array\n"
    when Hash
      print "  arg is a hash\n"
    else
      print "  arg is unknown\n"
  end
end
--
         yashi

In This Thread