mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cded3d5c93
commit
ce44928d2b
8 changed files with 34 additions and 18 deletions
|
@ -6,6 +6,7 @@
|
|||
.ccmalloc
|
||||
.ppack
|
||||
.ext
|
||||
.rbconfig.time
|
||||
COPYING.LIB
|
||||
ChangeLog.pre-alpha
|
||||
ChangeLog.pre1_1
|
||||
|
|
10
ChangeLog
10
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'
|
||||
|
|
14
ToDo
14
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
|
||||
|
|
6
error.c
6
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);
|
||||
|
|
2
eval.c
2
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;
|
||||
}
|
||||
|
|
13
io.c
13
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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue