Ruby-dev summary 20339-20427

Hi all,

This is a summary of ruby-dev ML in these days.

[ruby-dev:20357] Re: 1.8.0 preview 3 schedule

Koji Arai asked what Proc#call has changed from 1.6.
Summary:

* Proc objects which are given by Proc.new/&block_arg 

    -> non-strict arity check

       Proc.new {|a,b| }.call()    # no error

    -> break causes LocalJumpError

       Proc.new { break }.call    # LocalJumpError

* Proc objects which are given by lambda/proc

    -> strict arity check

       lambda {|a,b| }.call()   # ArgumentError

    -> break causes a break from the Proc.

       lambda { break }.call   # break from block

FYI:

···

# 1.6
#
~ % ruby-1.6.8 -e 'Proc.new {|a,b| }.call()'
-e:1: wrong # of arguments (0 for 2) (ArgumentError)
    from -e:1:in `call'
    from -e:1
~ % ruby-1.6.8 -e 'Proc.new { break }.call()'

~ % ruby-1.6.8 -e 'lambda {|a,b| }.call()'
-e:1: wrong # of arguments (0 for 2) (ArgumentError)
    from -e:1:in `call'
    from -e:1
~ % ruby-1.6.8 -e 'lambda { break }.call()'

#
# 1.8
#
~ % ruby-1.8.0 -e 'Proc.new {|a,b| }.call()'
~ % ruby-1.8.0 -e 'Proc.new { break }.call()'
-e:1:in `call': break from proc-closure (LocalJumpError)
    from -e:1

~ % ruby-1.8.0 -e 'lambda {|a,b| }.call()'
-e:1: wrong number of arguments (0 for 2) (ArgumentError)
    from -e:1:in `call'
    from -e:1
~ % ruby-1.8.0 -e 'lambda { break }.call()'

[ruby-dev:20362] [Oniguruma] quoting substring

K.Kosako announced Oniguruma’s new function, “literal quoting”.
e.g.

/....\Q.?*+\{}[]\E..../

means

/....\.\?\*\+\\\{\}\[\]..../

This function is implemented in regular expression libraries of
Perl and Java.

Attention: This function is TURNED OFF by default, at least in ruby.

[ruby-dev:20369] dRuby

Masatoshi SEKI announced that he imported dRuby in the CVS repository.
Ruby 1.8.0 preview 3 comes with dRuby “out of the box”.

[ruby-dev:20374] case sensitivity of the names of environment variables

U.Nakamura announced that now ruby does not distinguish character
cases for environment variables on Windows.

[ruby-dev:20379] locale and Marshal

Masao Mutoh reported a locale-specific Marshal problem.
See:

$ cat test.rb
require 'gtk2'
n = 12.34
p n
p Marshal.load(Marshal.dump(n))

$ LANG=es_ES ruby test.rb    
12,34
12,0       # !!!

Actually, this is a known bug.

1. Gtk+ calls setlocale(3).
2. Marshal module uses sprintf(3) to convert numeric to strings.
   sprintf(3) converts numeric in the manner of current locale.
3. Marshal module uses ruby's own strtod(3) to load numeric.
   It expects "C" locale string.
4. Restoration fails.

For temporal fix, reset LC_NUMERIC to “C”. e.g.

setlocale(LC_NUMERIC, "C");   /* in C, of course. */

[ruby-dev:20416] ruby 1.8.0 preview 3

Matz released ruby 1.8.0 preview 3.
Get it from:

ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.0-preview3.tar.gz

Note: I found some bugs on Alpha platform.
Alpha users should apply the patch below:

http://i.loveruby.net/archive/ruby-1.8.0-preview3-alphafix.diff.gz

– Minero Aoki