ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Michal Rokos <m.rokos@sh.cvut.cz>
To: ruby-core@ruby-lang.org
Subject: Re: [PATCH] object.c ruby.h (fwd)
Date: Sat, 27 Jul 2002 00:23:52 +0900	[thread overview]
Message-ID: <20020726152347.GA23409@klokan.sh.cvut.cz> (raw)
In-Reply-To: <200207251106.g6PB6HMJ008010@miso.k.notwork.org>

On Thu, Jul 25, 2002 at 08:06:17PM +0900, GOTO Kentaro wrote:
> Something built-in to get truth value of each object may help explain
> the boolean aspect in Ruby.
> 
>   % ruby -e '
>   module Kernel
>     def truth() !!self end
>   end
> 
>   p nil.truth  
>   p false.truth
>   p :else.truth
> 
>   '
>   false
>   false
>   true 
>

	I think if the RTEST returns 0 for Qnil or Qfalse, so Qnil is
	the same as Qfalse. (nil is false)

	If I look at SmallTalk: they distinguish between nil and false
	and I feel that thier attitude is the right one.

	To get the same level of real-word-perception as SmallTalk has,
	it is needed to:
	(1)	* raise error if argument to RTEST isn't kind of Boolean
	(2)	* remove all #to_* and boolean (#&, #|) methods for nil.

Note (1): I know that if we do this all code will be broken and has to
be rewritten or corrected. And that's why this has no solution for 
Ruby 1.x (- hopefully in Rite?)

Note (2): Makes it sence to convert 'Nothing' (nil) to Float or
Integer??? I don't think so.

PS: nil is instance NillClass (in Ruby). Class name in SmallTalk is
'UndefinedObject' - personally: I think that using nil in this sence
(UndefinedObject) is the right perception of 'nil' term.
 
	But there are much more skilled SmallTalkers than I have - I'd
	like to hear their opinion...
	
		Michal

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michal Rokos                         Czech Technical University, Prague
E-mail:m.rokos@sh.cvut.cz      ICQ:36118339      Jabber:majkl@jabber.cz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  parent reply	other threads:[~2002-07-26 15:23 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24 15:02 [PATCH] object.c ruby.h (fwd) Robert Skarwecki
2002-07-24 16:51 ` Boolean class (Re: [PATCH] object.c ruby.h) Yukihiro Matsumoto
2002-07-24 19:50 ` [PATCH] object.c ruby.h (fwd) GOTO Kentaro
2002-07-24 20:05   ` Dave Thomas
2002-07-25  4:22     ` unifying nil and false (Re: [PATCH] object.c ruby.h) Yukihiro Matsumoto
2002-07-25  4:59       ` Dave Thomas
2002-07-25  6:46         ` Yukihiro Matsumoto
2002-07-25 11:06     ` [PATCH] object.c ruby.h (fwd) GOTO Kentaro
2002-07-25 13:20       ` Dave Thomas
2002-07-25 17:42         ` nobu.nokada
2002-07-25 17:55           ` Dave Thomas
2002-07-25 18:11             ` nobu.nokada
2002-07-25 18:28               ` Dave Thomas
2002-07-25 19:53               ` GOTO Kentaro
2002-07-25 20:34                 ` Dave Thomas
2002-07-25 22:23                   ` GOTO Kentaro
2002-07-27  8:04                     ` Masaki Suketa
2002-07-27 12:40                       ` Dave Thomas
2002-08-03  9:04                         ` Masaki Suketa
2002-08-05  1:39                           ` NAKAMURA, Hiroshi
2002-08-06 11:53                             ` Masaki Suketa
2002-08-09 13:20                               ` NAKAMURA, Hiroshi
2002-08-10 12:19                                 ` Masaki Suketa
2002-08-12  3:48                                   ` NAKAMURA, Hiroshi
2002-07-26 10:11                   ` YANAGAWA Kazuhisa
2002-07-31 14:47                     ` A truth? patch + benchmarks Christoph
2002-07-31 15:03                       ` ts
2002-08-01  6:39                         ` Christoph
2002-08-01  7:02                           ` Yukihiro Matsumoto
2002-08-02  7:12                             ` Christoph
2002-08-02  7:20                               ` ts
2002-08-02  8:54                                 ` Christoph
2002-08-03  9:51                               ` Yukihiro Matsumoto
2002-08-05  0:58                                 ` Christoph
2002-08-05  1:44                                   ` nobu.nokada
2002-08-16  6:52               ` Mswin32 build flags Christoph
2002-08-16  7:12                 ` U.Nakamura
2002-09-03 18:51                   ` Christoph
2002-07-26  1:16         ` [PATCH] object.c ruby.h (fwd) NAKAMURA, Hiroshi
2002-07-26 15:23       ` Michal Rokos [this message]
2002-07-26 15:31         ` Dave Thomas
2002-07-26 16:37         ` Yukihiro Matsumoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020726152347.GA23409@klokan.sh.cvut.cz \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).