[#28942] FUNC_CDECL/FUNC_STDCALL are not defined? — KIMURA Koichi <kimura.koichi@...>

木村です。

24 messages 2006/07/03
[#28943] Re: FUNC_CDECL/FUNC_STDCALL are not defined? — "U.Nakamura" <usa@...> 2006/07/03

こんにちは、なかむら(う)です。

[#28945] Re: FUNC_CDECL/FUNC_STDCALL are not defined? — Takaaki Tateishi <ttate@...> 2006/07/03

U.Nakamura wrote:

[#28946] Re: FUNC_CDECL/FUNC_STDCALL are not defined? — "U.Nakamura" <usa@...> 2006/07/03

こんにちは、なかむら(う)です。

[#29006] block wrapper — Tanaka Akira <akr@...>

以前、[ruby-dev:28747] の pp.rb の問題を解決するのに

44 messages 2006/07/10
[#29007] Re: block wrapper — Yukihiro Matsumoto <matz@...> 2006/07/10

まつもと ゆきひろです

[#29008] Re: block wrapper — Tanaka Akira <akr@...> 2006/07/10

In article <1152541094.492146.23781.nullmailer@x31.priv.netlab.jp>,

[#29009] Re: block wrapper — Yukihiro Matsumoto <matz@...> 2006/07/10

まつもと ゆきひろです

[#29010] Re: block wrapper — Tanaka Akira <akr@...> 2006/07/10

In article <1152542689.441125.24418.nullmailer@x31.priv.netlab.jp>,

[#29022] Re: block wrapper — Tanaka Akira <akr@...> 2006/07/12

In article <87psgd8qb2.fsf@fsij.org>,

[#29078] Re: block wrapper — Tanaka Akira <akr@...> 2006/07/19

In article <87r70rdpeg.fsf@fsij.org>,

[#29466] Re: block wrapper — Tanaka Akira <akr@...> 2006/09/04

In article <871wshddvn.fsf@fsij.org>,

[#29584] Re: block wrapper — Tanaka Akira <akr@...> 2006/09/16

In article <87ac5g5a7i.fsf@fsij.org>,

[#29616] Re: block wrapper — Tanaka Akira <akr@...> 2006/09/26

In article <8764foo7s7.fsf@fsij.org>,

[#30777] Re: block wrapper — Tanaka Akira <akr@...> 2007/05/11

In article <87venar27i.fsf@fsij.org>,

[#30778] Re: block wrapper — Yukihiro Matsumoto <matz@...> 2007/05/11

まつもと ゆきひろです

[#30780] Re: block wrapper — Tanaka Akira <akr@...> 2007/05/12

In article <1178883053.645482.13087.nullmailer@x31.netlab.jp>,

[#30781] Re: block wrapper — Yukihiro Matsumoto <matz@...> 2007/05/12

まつもと ゆきひろです

[#30840] Re: block wrapper — Tanaka Akira <akr@...> 2007/05/30

In article <1178978140.846301.8164.nullmailer@x31.netlab.jp>,

[#30843] Re: block wrapper — Yukihiro Matsumoto <matz@...> 2007/05/30

まつもと ゆきひろです

[#30848] Re: block wrapper — SASADA Koichi <ko1@...> 2007/05/31

 ささだです。

[#30850] Re: block wrapper — Yukihiro Matsumoto <matz@...> 2007/05/31

まつもと ゆきひろです

[#30855] Re: block wrapper — Tanaka Akira <akr@...> 2007/05/31

In article <E1HtaMS-00041i-6U@x31>,

[#29013] problem in bignorm — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

14 messages 2006/07/10
[#29016] Re: problem in bignorm — Yukihiro Matsumoto <matz@...> 2006/07/11

まつもと ゆきひろです

[#29018] Re: problem in bignorm — "U.Nakamura" <usa@...> 2006/07/11

こんにちは、なかむら(う)です。

[#29019] Re: problem in bignorm — "U.Nakamura" <usa@...> 2006/07/11

こんにちは、なかむら(う)です。

[#29038] irb completion — Tadayoshi Funaba <tadf@...>

ふなばです。

22 messages 2006/07/17
[#29063] Re: irb completion — keiju@... (石塚圭樹) 2006/07/18

けいじゅ@いしつかです.

[#29064] Re: irb completion — Yukihiro Matsumoto <matz@...> 2006/07/18

まつもと ゆきひろです

[#29070] Re: irb completion — Ryan Davis <ryand-ruby@...> 2006/07/18

[#29093] Re: [ruby-cvs:17195] ruby/test/rss: * object.c (rb_mod_attr): make Module#attr to be an alias to — Tanaka Akira <akr@...>

In article <20060720173258.5D4BAC6781@lithium.ruby-lang.org>,

14 messages 2006/07/20
[#29096] Re: ruby/test/rss: * object.c (rb_mod_attr): make Module#attr to be an alias to — Yukihiro Matsumoto <matz@...> 2006/07/20

まつもと ゆきひろです

[#29097] Re: ruby/test/rss: * object.c (rb_mod_attr): make Module#attr to be an alias to — Tanaka Akira <akr@...> 2006/07/20

In article <1153423941.406034.21948.nullmailer@x31.priv.netlab.jp>,

[#29098] Re: ruby/test/rss: * object.c (rb_mod_attr): make Module#attr to be an alias to — Yukihiro Matsumoto <matz@...> 2006/07/20

まつもと ゆきひろです

[#29099] Re: ruby/test/rss: * object.c (rb_mod_attr): make Module#attr to be an alias to — Tanaka Akira <akr@...> 2006/07/20

In article <1153425319.663162.22588.nullmailer@x31.priv.netlab.jp>,

[#29101] Re: ruby/test/rss: * object.c (rb_mod_attr): make Module#attr to be an alias to — Yukihiro Matsumoto <matz@...> 2006/07/21

まつもと ゆきひろです

[#29148] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — WATANABE Hirofumi <eban@...>

わたなべです。

31 messages 2006/07/27
[#29149] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — "NARUSE, Yui" <naruse@...> 2006/07/27

成瀬です。

[#29151] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/07/27

まつもと ゆきひろです

[#29152] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — URABE Shyouhei <root@...> 2006/07/27

卜部です

[#29153] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/07/27

まつもと ゆきひろです

[#29155] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — URABE Shyouhei <root@...> 2006/07/27

卜部です。

[#29157] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — "NARUSE, Yui" <naruse@...> 2006/07/27

成瀬です。

[#29159] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/07/27

まつもと ゆきひろです

[#29440] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — "NARUSE, Yui" <naruse@...> 2006/09/03

成瀬です

[#29462] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/09/04

まつもと ゆきひろです

[#29467] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — "NARUSE, Yui" <naruse@...> 2006/09/04

成瀬です。

[#29472] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/09/04

まつもと ゆきひろです

[#29483] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — "NARUSE, Yui" <naruse@...> 2006/09/05

成瀬です。

[#29488] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/09/05

まつもと ゆきひろです

[#29494] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Tadayoshi Funaba <tadf@...> 2006/09/05

ふなばです。

[#29497] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/09/05

まつもと ゆきひろです

[#29513] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Tadayoshi Funaba <tadf@...> 2006/09/06

> 郵便局の消印は採用できないんですが、なにが良いと思いますか。

[#29516] Re: [ruby-cvs:17256] ruby, ruby: * time.c (time_to_s): generate RFC822 style date string. — Yukihiro Matsumoto <matz@...> 2006/09/06

まつもと ゆきひろです

[ruby-dev:29005] Re: Module#toplevel_eval

From: Hidetoshi NAGAI <nagai@...>
Date: 2006-07-10 10:22:58 UTC
List: ruby-dev #29005
永井@知能.九工大です.

From: Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Subject: [ruby-dev:28797] Re: Module#toplevel_eval
Date: Thu, 22 Jun 2006 18:48:55 +0900
Message-ID: <20060622.184854.112609658.nagai@ai.kyutech.ac.jp>
> > の2点でしょうか。前者はなんとかなりそうな気がしますが、後者
> > は(いまだ仕様さえ定かでない)classboxとかselector namespaceと
> > ほぼ同様の機能ですねえ。
> > 
> > あるいは、石塚さんのclass-in-stateみたいなのを実装するか...。
> > もうちょっと考えさせてください。
> 
> ご迷惑をかけてますが,よろしくお願い致します.

なかなか対応が難しそうな状況ですので,
「良いやり方ではないよなぁ」と思いつつ (^_^; 
応急処置的に下記コードのような戦略での対策を適用しました.

まぁなんとか最低限の範囲では誤魔化せているようではあるのですが,
他と衝突しやすそうな場当たり的対処ですので,
やはり真っ当な対応が望まれます.
1.8.5 のリリース直前では対応を間に合わせるのが難しくなる恐れも
ありますので,1日でも早くに対応していただけると嬉しく思います.

我が儘ばかりですみませんが,よろしくお願い致します.
---------------------------------------------------------------------
class Object
  alias __method_missing__ method_missing
  private :__method_missing__

  def method_missing(id, *args)
    begin
      has_top = (top = Thread.current[:TOPLEVEL]) && 
                   top.respond_to?(:pseudo_toplevel_evaluable?) && 
                   top.pseudo_toplevel_evaluable? && 
                   top.respond_to?(id)
    rescue Exception => e
      has_top = false
    end

    if has_top
      top.__send__(id, *args)
    else
      __method_missing__(id, *args)
    end
  end
end

class Proc
  def initialize(*args, &b)
    super
    @__pseudo_toplevel__ = Thread.current[:TOPLEVEL]
  end

  alias __call__ call
  def call(*args, &b)
    if top = @__pseudo_toplevel__
      orig_top = Thread.current[:TOPLEVEL]
      Thread.current[:TOPLEVEL] = top
      begin
        __call__(*args, &b)
      ensure
        Thread.current[:TOPLEVEL] = orig_top
      end
    else
      __call__(*args, &b)
    end
  end
end

def proc(&b)
  Proc.new(&b)
end
def lambda(&b)
  Proc.new(&b)
end

module PseudoToplevel_Evaluable
  def pseudo_toplevel_eval(body = Proc.new)
    orig_top = Thread.current[:TOPLEVEL]
    Thread.current[:TOPLEVEL] = self
    begin
      body.call
    ensure
      Thread.current[:TOPLEVEL] = orig_top
    end
  end

  def pseudo_toplevel_evaluable?
    @pseudo_toplevel_evaluable
  end
  def pseudo_toplevel_evaluable=(mode)
    @pseudo_toplevel_evaluable = (mode)? true: false
  end

  def self.extended(mod)
    mod.__send__(:extend_object, mod)
    mod.instance_variable_set('@pseudo_toplevel_evaluable', true)
  end
end

module M
  extend PseudoToplevel_Evaluable

  def foo(*args)
    p [self, :foo, args]
  end
end

class A
end

p M.methods.sort
p M.instance_methods.sort
puts '--- 1: A.new.instance_eval{foo(1,2,3)} ---'
begin
  A.new.instance_eval{foo(1,2,3)}
rescue => e
  p e
end

puts '--- 2: M.pseudo_toplevel_eval{A.new.instance_eval{foo(1,2,3)}} ---'
begin
  M.pseudo_toplevel_eval{A.new.instance_eval{foo(1,2,3)}}
rescue => e
  p e
end

puts '--- 3: M.pseudo_toplevel_eval{A.new.instance_eval{self.foo(1,2,3)}} ---'
begin
  M.pseudo_toplevel_eval{A.new.instance_eval{self.foo(1,2,3)}}
rescue => e
  p e
end

puts '--- 4: foo(1,2,3) ---'
begin
  foo(1,2,3)
rescue => e
  p e
end

puts '--- 5: M.pseudo_toplevel_eval{foo(1,2,3)} ---'
begin
  M.pseudo_toplevel_eval{foo(1,2,3)}
rescue => e
  p e
end

require 'tk'
puts '--- 6: TkButton.new{p foo(1,2,3)} ---'
begin
  TkButton.new{p foo(1,2,3)}
rescue => e
  p e
end

puts '--- 7: M.pseudo_toplevel_eval{TkButton.new{p foo(1,2,3)}} ---'
begin
  M.pseudo_toplevel_eval{TkButton.new{p foo(1,2,3)}}
rescue => e
  p e
end

begin
  M.pseudo_toplevel_eval{
    l = TkLabel.new.pack
    cnt = 0
    TkButton.new(:command=>proc{l.text = foo(cnt); cnt+=1}){p foo(1,2,3)}.pack
  }
rescue => e
  p e
end

Tk.mainloop
---------------------------------------------------------------------
-- 
                                       永井 秀利 (九工大 知能情報)
                                           nagai@ai.kyutech.ac.jp

In This Thread

Prev Next