[#28217] ANDCALL operator (Re: [ruby-list:41768] Re: nilの扱い) — nobuyoshi nakada <nobuyoshi.nakada@...>
なかだです。
6 messages
2006/01/13
[#28223] FYI: Fix bug: FileUtils.mv() does not unlink source file when moving over filesystem boundaries — 植田裕之 <ueda@...>
植田と申します。
7 messages
2006/01/17
[#28227] Re: FYI: Fix bug: FileUtils.mv() does not unlink source file when moving over filesystem boundaries
— akira yamada / やまだあきら <akira@...>
2006/01/17
植田裕之 wrote:
[#28230] bcc32 memory manager — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
15 messages
2006/01/18
[#28231] Re: bcc32 memory manager
— "U.Nakamura" <usa@...>
2006/01/18
こんにちは、なかむら(う)です。
[#28232] Re: bcc32 memory manager
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/18
山本です。
[#28358] Re: bcc32 memory manager
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/02/21
山本です。
[#28376] Re: bcc32 memory manager
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/02/23
山本です。
[#28233] 1.8.5 release plan? — "URABE Shyouhei aka. mput" <root@...>
卜部です。
9 messages
2006/01/18
[#28240] String クラス insert メソッド — 北浦 友規 <uv2t-ktur@...>
String クラスの insert メソッドは、
6 messages
2006/01/19
[#28243] FUNCTION_CALL_MAY_RETURN_TWICE — Hajimu UMEMOTO <ume@...>
梅本です。
18 messages
2006/01/20
[#28247] Re: FUNCTION_CALL_MAY_RETURN_TWICE
— Tanaka Akira <akr@...17n.org>
2006/01/20
In article <ygezmlrqybi.wl%ume@mahoroba.org>,
[#28253] Re: FUNCTION_CALL_MAY_RETURN_TWICE
— Tanaka Akira <akr@...17n.org>
2006/01/21
In article <ygeoe26gnuj.wl%ume@mahoroba.org>,
[#28254] Re: FUNCTION_CALL_MAY_RETURN_TWICE
— Hajimu UMEMOTO <ume@...>
2006/01/21
梅本です。
[#28255] Re: FUNCTION_CALL_MAY_RETURN_TWICE
— Tanaka Akira <akr@...17n.org>
2006/01/21
In article <ygelkxagkse.wl%ume@mahoroba.org>,
[#28261] Re: FUNCTION_CALL_MAY_RETURN_TWICE
— Hajimu UMEMOTO <ume@...>
2006/01/21
梅本です。
[#28270] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
山本です。
17 messages
2006/01/23
[#28271] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/23
山本です。
[#28272] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— WATANABE Hirofumi <eban@...>
2006/01/23
わたなべです。
[#28273] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/23
山本です。
[#28274] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/24
山本です。
[#28275] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "U.Nakamura" <usa@...>
2006/01/24
こんにちは、なかむら(う)です。
[#28276] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/24
山本です。
[#28277] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/24
山本です。
[#28278] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/24
山本です。
[#28279] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/24
山本です。
[#28281] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/25
[#28282] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— Yukihiro Matsumoto <matz@...>
2006/01/25
まつもと ゆきひろです
[#28283] Re: [PATCH] solaris 10 isinf and ruby_setenv fixes
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/01/26
山本です。
[#28286] SEGV with zlib — Tanaka Akira <akr@...17n.org>
最近、Data オブジェクトの free 関数が気になっているのですが、
24 messages
2006/01/30
[#28303] Re: SEGV with zlib
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/02/06
山本です。
[#28304] Re: SEGV with zlib
— Yukihiro Matsumoto <matz@...>
2006/02/06
まつもと ゆきひろです
[#28305] Re: SEGV with zlib
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/02/06
山本です。
[#28306] Re: SEGV with zlib
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/02/06
山本です。
[#28307] Re: SEGV with zlib
— Tietew <tietew-ml-ruby-dev@...>
2006/02/06
[#28308] Re: SEGV with zlib
— Yukihiro Matsumoto <matz@...>
2006/02/06
まつもとゆきひろです。
[#28309] Re: SEGV with zlib
— Yukihiro Matsumoto <matz@...>
2006/02/07
まつもと ゆきひろです
[#28310] Re: SEGV with zlib
— "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
2006/02/07
山本です。
[#28312] Re: SEGV with zlib
— Yukihiro Matsumoto <matz@...>
2006/02/07
まつもと ゆきひろです
[#28316] Re: SEGV with zlib
— Tanaka Akira <akr@...17n.org>
2006/02/07
In article <34e00f690602060546l1ef5b22em52589f23240a8e43@mail.gmail.com>,
[#28317] Re: SEGV with zlib
— Yukihiro Matsumoto <matz@...>
2006/02/08
まつもと ゆきひろです
[#28318] Re: SEGV with zlib
— Tanaka Akira <akr@...17n.org>
2006/02/08
In article <1139361872.676364.14519.nullmailer@x31.priv.netlab.jp>,
[ruby-dev:28225] Re: const_defined? behavior
From:
nobuyoshi nakada <nobuyoshi.nakada@...>
Date:
2006-01-17 05:15:34 UTC
List:
ruby-dev #28225
なかだです。
At Mon, 16 Jan 2006 17:05:29 +0900,
Daniel Amelang wrote in [ruby-talk:175899]:
> Is this the intended behavior of const_defined?
>
> >> IO::SYNC
> => 4096
> >> IO.const_defined? :SYNC
> => false
>
> It appears that const_defined? only returns true if the class is the
> originator of the constant. If the constant was borrowed from
> somewhere else (in this case, File::Constants), it returns false.
Module#const_get でも mod::CONST 形式でも、継承した定数を無視す
ることはないので、 const_defined? だけが例外になっています。デ
フォルトは const_get に合わせて、省略可能な引数で継承した定数を
無視できるようにするのはどうでしょうか。
method_defined? もちょっと悩ましいですが。
Index: object.c
===================================================================
RCS file: /cvs/ruby/src/ruby/object.c,v
retrieving revision 1.182
diff -U2 -p -r1.182 object.c
--- object.c 12 Dec 2005 03:04:53 -0000 1.182
+++ object.c 17 Jan 2006 05:09:58 -0000
@@ -1629,20 +1629,32 @@ rb_mod_attr_accessor(int argc, VALUE *ar
/*
* call-seq:
- * mod.const_get(sym) => obj
+ * mod.const_get(sym, inherit=true) => obj
*
* Returns the value of the named constant in <i>mod</i>.
*
* Math.const_get(:PI) #=> 3.14159265358979
+ *
+ * If the constant is not defined or is defined by the ancestors and
+ * +inherit+ is false, +NameError+ will be raised.
*/
static VALUE
-rb_mod_const_get(VALUE mod, VALUE name)
+rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
{
- ID id = rb_to_id(name);
+ VALUE name, recur;
+ ID id;
+ if (argc == 1) {
+ name = argv[0];
+ recur = Qtrue;
+ }
+ else {
+ rb_scan_args(argc, argv, "11", &name, &recur);
+ }
+ id = rb_to_id(name);
if (!rb_is_const_id(id)) {
rb_name_error(id, "wrong constant name %s", rb_id2name(id));
}
- return rb_const_get(mod, id);
+ return RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
}
@@ -1673,21 +1685,32 @@ rb_mod_const_set(VALUE mod, VALUE name,
/*
* call-seq:
- * mod.const_defined?(sym) => true or false
+ * mod.const_defined?(sym, inherit=true) => true or false
*
* Returns <code>true</code> if a constant with the given name is
- * defined by <i>mod</i>.
+ * defined by <i>mod</i>, or its ancestors if +inherit+ is not false.
*
* Math.const_defined? "PI" #=> true
+ * IO.const_defined? "SYNC" #=> true
+ * IO.const_defined? "SYNC", false #=> false
*/
static VALUE
-rb_mod_const_defined(VALUE mod, VALUE name)
+rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
{
- ID id = rb_to_id(name);
+ VALUE name, recur;
+ ID id;
+ if (argc == 1) {
+ name = argv[0];
+ recur = Qtrue;
+ }
+ else {
+ rb_scan_args(argc, argv, "11", &name, &recur);
+ }
+ id = rb_to_id(name);
if (!rb_is_const_id(id)) {
rb_name_error(id, "wrong constant name %s", rb_id2name(id));
}
- return rb_const_defined_at(mod, id);
+ return RTEST(recur) ? rb_const_defined(mod, id) : rb_const_defined_at(mod, id);
}
@@ -2499,7 +2522,7 @@ Init_Object(void)
rb_define_method(rb_cModule, "constants", rb_mod_constants, 0); /* in variable.c */
- rb_define_method(rb_cModule, "const_get", rb_mod_const_get, 1);
+ rb_define_method(rb_cModule, "const_get", rb_mod_const_get, -1);
rb_define_method(rb_cModule, "const_set", rb_mod_const_set, 2);
- rb_define_method(rb_cModule, "const_defined?", rb_mod_const_defined, 1);
+ rb_define_method(rb_cModule, "const_defined?", rb_mod_const_defined, -1);
rb_define_private_method(rb_cModule, "remove_const",
rb_mod_remove_const, 1); /* in variable.c */
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦