[#237] object.c ruby.h (fwd) — Robert Skarwecki <skaav@...>

Hello everybody,

42 messages 2002/07/24
[#239] Re: [PATCH] object.c ruby.h (fwd) — GOTO Kentaro <gotoken@...> 2002/07/24

At Thu, 25 Jul 2002 00:02:28 +0900,

[#240] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/24

GOTO Kentaro <gotoken@notwork.org> writes:

[#246] Re: [PATCH] object.c ruby.h (fwd) — GOTO Kentaro <gotoken@...> 2002/07/25

At Thu, 25 Jul 2002 05:05:46 +0900,

[#247] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/25

GOTO Kentaro <gotoken@notwork.org> writes:

[#248] Re: [PATCH] object.c ruby.h (fwd) — nobu.nokada@... 2002/07/25

Hi,

[#249] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/25

nobu.nokada@softhome.net writes:

[#250] Re: [PATCH] object.c ruby.h (fwd) — nobu.nokada@... 2002/07/25

Hi,

[#252] Re: [PATCH] object.c ruby.h (fwd) — GOTO Kentaro <gotoken@...> 2002/07/25

At Fri, 26 Jul 2002 03:11:02 +0900,

[#253] Re: [PATCH] object.c ruby.h (fwd) — Dave Thomas <Dave@...> 2002/07/25

GOTO Kentaro <gotoken@notwork.org> writes:

Re: [PATCH] object.c ruby.h (fwd)

From: kjana@...4lab.to (YANAGAWA Kazuhisa)
Date: 2002-07-26 10:11:12 UTC
List: ruby-core #260
In message <m2bs8vr1h7.fsf@zip.local.thomases.com>
Dave@PragmaticProgrammer.com writes:

> So, perhaps, if the expression to pass to 'if', 'while', and friends
> isn't 'true' or 'false', the interpreter should call #truth? on it to
> coerce it into a truth value.[1]
> 
> If that sounds logical, then perhaps #to_truth might be a more
> consistent name.

That's like my old proposal on.... where? :-) Matz rejected that since
its cost may be too expensive.  So if you state it strongly, show its
usefulness and effective implementation.



> [1] Doing this would allow Perl fans to do
> 
>   class String
>     def truth?
>       !empty?
>     end
>   end
>   class Integer
>     def truth?
>       !zero?
>     end
>   end

My proposal is inspired by a discussion on Regexp.last_match, where
someone said `/re/.match() should return always MatchData'.  To solve
its compatibility problem, introducing a conversion method like to_ary
or to_int then we can write `if /re/.match() ...' again, where
MatchData#to_bool returns true if matched, false else.

# Uhm, a bad summary :-P


-- 
kjana@dm4lab.to                                  July 26, 2002
Translators, traitors.

In This Thread