summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cvsignore1
-rw-r--r--ChangeLog10
-rw-r--r--ToDo14
-rw-r--r--error.c6
-rw-r--r--eval.c2
-rw-r--r--io.c13
-rw-r--r--lib/optparse.rb2
-rw-r--r--lib/pathname.rb4
8 files changed, 34 insertions, 18 deletions
diff --git a/.cvsignore b/.cvsignore
index 309f85c515..0c885edbf7 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -6,6 +6,7 @@
.ccmalloc
.ppack
.ext
+.rbconfig.time
COPYING.LIB
ChangeLog.pre-alpha
ChangeLog.pre1_1
diff --git a/ChangeLog b/ChangeLog
index 2742c6cc43..f0ab3b1db6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Apr 6 00:14:43 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * error.c (Init_Exception): remove Exception#to_str. [Ruby2]
+
+ * eval.c (error_print): should no call "to_str" anymore use
+ "message" method instead.
+
+ * io.c (rb_f_open): Kernel#open() calls "to_open" if the first
+ argument responds to it. [Ruby2]
+
Tue Apr 6 00:13:43 2004 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/rinda/rinda.rb: add require 'drb/drb'
diff --git a/ToDo b/ToDo
index b55e399edf..7e5ef523a8 100644
--- a/ToDo
+++ b/ToDo
@@ -2,6 +2,10 @@ Language Spec.
- Class#allocate - basicNew
- class Foo::Bar<Baz .. end, module Boo::Bar .. end
+- raise exception by `` error
+- a +1 to be a+1, not a(+1).
+- clarify evaluation order of operator argument (=~, .., ...)
+- :symbol => value hash in the form of {symbol: value, ...} ??
* operator !! for rescue. ???
* objectify characters
* ../... outside condition invokes operator method too.
@@ -14,7 +18,6 @@ Language Spec.
* def Class#method .. end ??
* def Foo::Bar::baz() .. end ??
* I18N (or M17N) script/string/regexp
-* Fixnum 0 as false ????
* discourage use of symbol variables (e.g. $/, etc.) in manual
* discourage use of Perlish features by giving warnings.
* non confusing in-block local variable (is it possible?)
@@ -22,12 +25,9 @@ Language Spec.
+ variables appears within block may have independent values.
* Regexp: make /o thread safe.
* decide whether begin with rescue or ensure make do..while loop.
-* a +1 to be a+1, not a(+1).
* unify == and eql? again
* to_i returns nil if str contains no digit.
-* raise exception by `` error
* jar like combined library package. -> RubyGems?
-* resumable Exception via Exception#resume.
* method combination, e.g. before, after, around, etc.
* .. or something like defadvice in Emacs.
* property - for methods, or for objects in general.
@@ -35,8 +35,6 @@ Language Spec.
* selector namespace - something like generic-flet in CLOS, to help RubyBehavior
* private instance variable (as in Python?) @_foo in class Foo => @_Foo_foo
* warn/error "bare word" method, like "foo", you should type "foo()"
-* clarify evaluation order of operator argument (=~, .., ...)
-* :symbol => value hash in the form of {symbol: value, ...} ??
Hacking Interpreter
@@ -83,7 +81,7 @@ Standard Libraries
- use Mersenne Twister RNG for random.
- deprecate Array#indexes, and Array#indices.
- remove dependency on MAXPATHLEN.
-* String#scanf(?)
+- String#scanf(?)
* Object#fmt(?)
* Time::strptime
* Integer[num], Float[num]; Fixnum[num]?
@@ -117,7 +115,7 @@ Extension Libraries
Ruby Libraries
-* urllib.rb, nttplib.rb, etc.
+- urllib.rb, nttplib.rb, etc.
* format like perl's
Tools
diff --git a/error.c b/error.c
index 8dbd3434ce..bcea38d9e7 100644
--- a/error.c
+++ b/error.c
@@ -405,7 +405,6 @@ exc_to_s(exc)
/*
* call-seq:
* exception.message => string
- * exception.to_str => string
*
* Returns the result of invoking <code>exception.to_s</code>.
* Normally this returns the exception's message or name. By
@@ -414,7 +413,7 @@ exc_to_s(exc)
*/
static VALUE
-exc_to_str(exc)
+exc_message(exc)
VALUE exc;
{
return rb_funcall(exc, rb_intern("to_s"), 0, 0);
@@ -962,8 +961,7 @@ Init_Exception()
rb_define_method(rb_eException, "exception", exc_exception, -1);
rb_define_method(rb_eException, "initialize", exc_initialize, -1);
rb_define_method(rb_eException, "to_s", exc_to_s, 0);
- rb_define_method(rb_eException, "to_str", exc_to_str, 0);
- rb_define_method(rb_eException, "message", exc_to_str, 0);
+ rb_define_method(rb_eException, "message", exc_message, 0);
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1);
diff --git a/eval.c b/eval.c
index a66f710a8a..a46157fc0b 100644
--- a/eval.c
+++ b/eval.c
@@ -1125,7 +1125,7 @@ error_print()
eclass = CLASS_OF(ruby_errinfo);
if (EXEC_TAG() == 0) {
- e = rb_obj_as_string(ruby_errinfo);
+ e = rb_funcall(ruby_errinfo, rb_intern("message"), 0, 0);
einfo = RSTRING(e)->ptr;
elen = RSTRING(e)->len;
}
diff --git a/io.c b/io.c
index ef46499920..a5f6f1431d 100644
--- a/io.c
+++ b/io.c
@@ -3039,10 +3039,17 @@ rb_f_open(argc, argv)
VALUE *argv;
{
if (argc >= 1) {
- char *str = StringValuePtr(argv[0]);
+ ID to_open = rb_intern("to_open");
- if (str[0] == '|') {
- return rb_io_popen(str+1, argc, argv, rb_cIO);
+ if (rb_respond_to(argv[0], to_open)) {
+ return rb_funcall2(argv[0], to_open, argc-1, argv+1);
+ }
+ else {
+ char *str = StringValuePtr(argv[0]);
+
+ if (str[0] == '|') {
+ return rb_io_popen(str+1, argc, argv, rb_cIO);
+ }
}
}
return rb_io_s_open(argc, argv, rb_cFile);
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 4a979a78d1..761504a82f 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1584,7 +1584,6 @@ Base class of exceptions from ((<OptionParser>))
Returns inspection string.
--- OptionParser::ParseError#message
--- OptionParser::ParseError#to_s
---- OptionParser::ParseError#to_str
Default stringizing method to emit standard error message.
=end #'#"#`#
class ParseError < RuntimeError
@@ -1625,7 +1624,6 @@ Base class of exceptions from ((<OptionParser>))
end
alias to_s message
- alias to_str message
end
=begin
diff --git a/lib/pathname.rb b/lib/pathname.rb
index a6d0599610..c87a6e91ce 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -229,6 +229,10 @@ class Pathname
"#<#{self.class}:#{@path}>"
end
+ def to_open(*args) # :nodoc:
+ Kernel::open(@path, *args)
+ end
+
#
# Returns clean pathname of +self+ with consecutive slashes and useless dots
# removed. The filesystem is not accessed.