From: GOTO Kentaro <gotoken@notwork.org>
To: ruby-core@ruby-lang.org
Subject: Re: [PATCH] object.c ruby.h (fwd)
Date: Fri, 26 Jul 2002 07:23:15 +0900 [thread overview]
Message-ID: <200207252222.g6PMMwPO014770@miso.k.notwork.org> (raw)
In-Reply-To: <m2bs8vr1h7.fsf@zip.local.thomases.com>
At Fri, 26 Jul 2002 05:34:10 +0900,
Dave Thomas wrote:
> If you call Regexp#match with a non-string argument, it calls that
> argument's to_str method to coerce it into a string.
>
> 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]
Oops! Sorry, I misunderstood that `and' or `or' treat conditions as
same as `if' or `while' do. Now I agree your opinion but would like
to withdraw proposition to introduce anything built-in to obtain truth
value for each object. The truth is not simple indeed.
% ruby17 -e '$_ = "foo"; /x/ or puts :pass'
% ruby17 -e '$_ = "foo"; puts :pass unless /x/'
pass
% ruby17 -v
ruby 1.7.2 (2002-07-13) [i386-freebsd4.5]
By the way, how about asking the auther to fit the behavior of
RubyUnit's assert() to Test::Unit's?
% ruby ~/foo.rb
Test::Unit ------------------------------
Loaded suite TestTU
Started...
.
Finished in 0.003085 seconds.
1 runs, 1 assertions, 0 failures, 0 errors
RubyUnit ------------------------------
TestRU#test_x E.
Time: 0.177137
FAILURES!!!
Test Results:
Run: 1/1(1 asserts) Failures: 0 Errors: 1
Errors: 1
/home/gotoken/foo.rb:21:in `test_x'(TestRU): 1st argument <1> type should be TrueClass or FalseClass. (TypeError)
from /home/gotoken/foo.rb:25
% cat ~/foo.rb
puts "Test::Unit ------------------------------"
require "test/unit"
require "test/unit/ui/console/testrunner"
class TestTU < Test::Unit::TestCase
def test_x
assert(1)
end
end
Test::Unit::UI::Console::TestRunner.run(TestTU)
puts "RubyUnit ------------------------------"
require "runit/testcase"
require "runit/cui/testrunner"
class TestRU < RUNIT::TestCase
def test_x
assert(1)
end
end
RUNIT::CUI::TestRunner.run(TestRU.suite)
%
-- Gotoken
next prev parent reply other threads:[~2002-07-25 22: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 [this message]
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
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=200207252222.g6PMMwPO014770@miso.k.notwork.org \
--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).