[#20036] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

16 messages 2003/04/18
[#20045] Re: Roundoff problem with Float and Marshal — nobu.nakada@... 2003/04/20

なかだです。

[#20063] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto) 2003/04/22

まつもと ゆきひろです

[#20097] jcode.rb — akira yamada / やまだあきら <akira@...>

25 messages 2003/04/26
[#20098] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/27

まつもと ゆきひろです

[#20105] Re: jcode.rb — WATANABE Hirofumi <eban@...> 2003/04/28

わたなべです。

[#20108] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/28

まつもと ゆきひろです

[ruby-dev:20118] Re: jcode.rb

From: Shin-ichiro HARA <sinara@...>
Date: 2003-04-30 10:13:09 UTC
List: ruby-dev #20118
原です。

>まつもと ゆきひろです

>|わたなべです。

>|以前石塚さんのscope-in-sateの話が出たときに
>|
>|  module Jcode
>|    module String
>|      ...
>|    end
>|  end
>|
>|という構成にすれば
>|
>|  ScopeJcode = ScopeInState.new(Jcode)
>|   
>|  p 'あい'.chop             #=> "あ\244"
>|  ScopeJcode.scope_in do
>|    p 'あい'.chop           #=> "あ"
>|  end
>|  p 'あい'.chop             #=> "あ\244"
>|
>|とできていいんじゃないかなと思ったことがあります。
>|原先生のimport-moduleでもできると思いますが、
>|どちらか標準にならないかなあ。
>
>標準にするのは構わないんですが、似たようなのが複数あるのは避
>けたいので、どちらを選ぶかですよね。実際に使った人の感想が聞
>きたいです。あ、もちろん作った人の感想も。

実際に使って見た人いるんですかね。私も感想が聞きたいです。

import-module では、こんなふうに使います:

  require 'import-module'
  require 'jstring_2'
  $KCODE='e'
  
  str1 = 'あいうえお'
  str2 = 'あいうえお'
  
  str1.import(JString) do
    p str1[2] # => "う"
    p str2[2] # => 164
    p str1.chop #=> "あいうえ"
    p str2.chop #=> "あいうえ\244"
    str2.import(JString) do
      p str1[2] # => "う"
      p str2[2] # => "う"
      p str1.chop #=> "あいうえ"
      p str2.chop #=> "あいうえ"
    end
  end
  p str1.import(JString){|s| s[2]} #=> "う"
  p str1[2] # => 164
  p str1.import(JString){str1.chop} #=> "あいうえ"
  p str2.chop #=> "あいうえ\244"
  
これは今の jstring_2.rb でも動いています。

石塚さんの scope-in-state は、もうちょっと大規模なシステムの
変更も念頭にあって、手軽さでは import-module かな。

もっとも、import-module の中身は大分石塚さんのアイデアを取り
込んでるんですが。


In This Thread