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

From: Dave Thomas <Dave@...>
Date: 2000-11-26 18:12:11 UTC
List: ruby-talk #6581
Maurice Szmurlo <maurice@europia.fr> writes:

> 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)

It's because infinite? is trying to get extra information back to you:

  a = 1.0/0		# => Infinity
  a.infinite?		# => 1
  a = -1.0/0		# => -Infinity
  a.infinite?		# => -1

> 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)?

I believe a boolean class may be on the way.

Nil is false simply because it's convenient:

   h[key] = 0 unless h[key]

or

   h[hey] ||= 0

or

   while STDIN.gets

and so on.

Personally, I'd argue to remove true and false, as their position is
far more tenuous, but I can live with them once they're here.


Dave

In This Thread

Prev Next