[#6363] Re: rescue clause affecting IO loop behavior — ts <decoux@...>

>>>>> "D" == David Alan Black <dblack@candle.superlink.net> writes:

17 messages 2000/11/14
[#6367] Re: rescue clause affecting IO loop behavior — David Alan Black <dblack@...> 2000/11/14

Hello again --

[#6582] best way to interleaf arrays? — David Alan Black <dblack@...>

Hello --

15 messages 2000/11/26

[#6646] RE: Array Intersect (&) question — Aleksi Niemel<aleksi.niemela@...>

Ross asked something about widely known and largely ignored language (on

23 messages 2000/11/29
[#6652] RE: Array Intersect (&) question — rpmohn@... (Ross Mohn) 2000/11/29

aleksi.niemela@cinnober.com (Aleksi Niemel) wrote in

[#6723] Re: Array Intersect (&) question — Mathieu Bouchard <matju@...> 2000/12/01

> >Use a hash. Here's code to do both and more. It assumes that

[#6656] printing/accessing arrays and hashes — raja@... (Raja S.)

I'm coming to Ruby with a Python & Common Lisp background.

24 messages 2000/11/30

[ruby-talk:6672] Re: printing/accessing arrays and hashes

From: "Hal E. Fulton" <hal9000@...>
Date: 2000-11-30 12:50:53 UTC
List: ruby-talk #6672
----- Original Message ----- 
From: Dave Thomas <Dave@thomases.com>
To: ruby-talk ML <ruby-talk@netlab.co.jp>
Sent: Wednesday, November 29, 2000 9:41 PM
Subject: [ruby-talk:6665] Re: printing/accessing arrays and hashes


> raja@cs.indiana.edu (Raja S.) writes:
> 
> > Interesting that Ruby does a #to_s on the elements of the array
> > first.
> 
> Actually, what happens is that when you concatenate something to an
> existing string, if that something isn't already a string, its to_str
> method is called.
> 
>    "a" + 1
>    -:1:in `+': failed to convert Fixnum into String (TypeError)
>   from -:1
> 
>    class Fixnum
>       def to_str
>         "Number: " + to_s
>       end
>    end
> 
>    "a" + 1     #=> "aNumber: 1"
> 

That's interesting, Dave. Is the behavior of << the same? Because I 
have found that the docs say "anObject" but it only seems to work
with another string.

Why, incidentally, is to_str called instead of to_s? I have never
understood that yet. Same for to_a and to_ary.

Hal





In This Thread