Ruby-dev summary #20316-20338

Hello all,

This is a summary for last week on the ruby-dev mailing list.
I’m sorry to post this too late.

[ruby-dev:20320] singleton_method_added is not in Apollo.exe

Apollo.exe is a development environment for Ruby with
Delphi.
YOSHIDA Kazuhiro, the developer of Apollo, pointed out that
singleton_method_added is not called in Apollo.exe with
recent Ruby.
usa answered that if ruby_run is not called, an internal
variable ruby_running is not set, then singleton_method_added
is not invoked in rb_add_method().

[ruby-dev:20335] 1.8 gsub

hsuzu asked how we can write the below script in Ruby 1.8
without warning:

’ ‘.gsub(’ ', ‘’)

Koji Arai explained that gsub method with two string arguments
in Ruby 1.8 means:

str.gsub(Regexp.compile(Regexp.quote(patstr)), repl)

Notice that gsub method in Ruby 1.6 means:

str.gsub(Regexp.compile(patstr), repl)

and they are incompatible.

Regards,

TAKAHASHI ‘Maki’ Masayoshi (maki@rubycolor.org)

  [ruby-dev:20320] singleton_method_added is not in Apollo.exe

Apollo.exe is a development environment for Ruby with
Delphi.
YOSHIDA Kazuhiro, the developer of Apollo, pointed out that
singleton_method_added is not called in Apollo.exe with
recent Ruby.
usa answered that if ruby_run is not called, an internal
variable ruby_running is not set, then singleton_method_added
is not invoked in rb_add_method().

This is a problem : plruby fail its test just because ruby_running was not
set.

After setting this variable it worked fine.

Needless to say that persons which embed ruby will have problems (and it
exist if I'm right only one method to set this variable).

Guy Decoux

i,

This is a problem : plruby fail its test just because ruby_running was not
set.

After setting this variable it worked fine.

Needless to say that persons which embed ruby will have problems (and it
exist if I’m right only one method to set this variable).

Does this patch work for you?

— eval.c 16 Jul 2003 09:23:33 -0000 1.482
+++ eval.c 17 Jul 2003 05:23:49 -0000 1.483
@@ -1202,2 +1201,3 @@ ruby_init()
ruby_scope = top_scope;

  • ruby_running = 1;
    }
    @@ -1367,3 +1367,2 @@ ruby_exec()
    Init_stack((void*)&tmp);
  • ruby_running = 1;
    PUSH_TAG(PROT_NONE);
···

In message “Re: ruby-dev summary #20316-20338” on 03/07/16, ts decoux@moulon.inra.fr writes:

@@ -1202,2 +1201,3 @@ ruby_init()

Work fine.

My problem was that plruby do something like this

   def method_missing(id, *args)
      # retrieve the source for the method
      eval "def PLtemp.#{id.id2name}(*args) #{source}; end"
      PLtemp.send(id, *args)
   end

because ruby_running = 0, the value in the cache was not updated and when
#send was called ruby call another time #method_missing and it give me an
error (method redefined : it work with $SAFE >= 4)

Guy Decoux