[#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:6580] booleans

From: Maurice Szmurlo <maurice@...>
Date: 2000-11-26 16:39:06 UTC
List: ruby-talk #6580
hello

I was experimenting the behaviour of ruby when I came across the
following:

ruby 1 > puts 1 == 1
true
ruby 2 > puts 1 == 2
false

this sounds OK, but why do I get "1" and "nil" in the following:

ruby 3 > a = 10**10000 / 1.5
ruby 4 > puts a
Infinity  ## still OK
ruby 5 > puts a.infinite?
1  ## oups! why not "true"?
ruby 6 > a = 10.0
ruby 7 > puts a.infinite?
nil  ## oups! why not "false"?

(the "finite?" predicate returns true and false)

even if it does not affect the trouth or falseness of the results,
is it an unconsistancy of this predicate (a bug) or is there a 
good reason for this?

a more general question is: if every thing except nil (and false) is
true, 
what is the need for "true" and "false": nil and any thing else is
sufficient.
conversely if true and false are to exist (which I agree with at least
for
esthetic reasons) why are't they both the only members of a "Boolean"
class 
and why isn't nil true (only false would represent false)?

the strange thing is that false is different from nil (2 different kinds
of 
falsenesses?) which leads to funny things as:

ruby 1 > a = 10.0
ruby 2 > puts a
10.0
ruby 3 > if a.infinite? == false
ruby| puts "a is finite"
ruby| else
ruby| puts "a is infinite"
ruby| end
a is infinite
ruby 4 > 

any enlightement is welcome

maurice

ps: 
maurice@garfield> ruby -v
ruby 1.6.1 (2000-09-27) [i586-linux]

In This Thread

Prev Next