Ruby-dev summary 21254-21294

Hello,

This is a summary of ruby-dev mailing list last week.

[ruby-dev:21277] multiple assignment

Koji Arai found a difference of multiple assignment
between 1.6 and 1.8.

ex:

*a = *[]; p a
def f; yield; end; f {|*a| p a}
def r; return; end; *a = r(); p a
=> ruby 1.6.8 (2003-08-03) [i586-linux]
[]
[nil]
[nil]
=> ruby 1.8.0 (2003-08-28) [i586-linux]
[]
[]
[nil]

       *a = *[1,2]; p a

def f; yield *[1,2]; end; f {|*a| p a}
def r; return *[1,2]; end; a = r(); p a
=> -:2: warning: *' interpreted as argument prefix ruby 1.6.8 (2003-08-03) [i586-linux] [1, 2] [1, 2] [1, 2] => -:2: warning:
’ interpreted as argument prefix
ruby 1.8.0 (2003-08-28) [i586-linux]
[1, 2]
[1, 2]
[[1, 2]]

Matz replied that it’s not a bug of 1.8, but it shows
peculiar property of return (and break).

LHS of multiple assignment and block parameters can find
whether RHS is (pseudo-)multivalue or not.
But if RHS is a method, LHS cannot find that.
When you want to use multiple assignment with return value
of a method, you should put ‘*’ before the method,
not after return.

[ruby-dev:21292] parsedate.rb and time.rb

Tadayoshi Funaba, the maintainer of parsedate.rb, pointed out
parsedate.rb doesn’t support ‘year/month’ format but time.rb does.
He thought parsedate.rb should not support that format.
Tanaka Akira, the maintainer of time.rb, agreed and fixed
time.rb.

Rationale:

  • date formats that parsedate supports should have
    a year, a month and a day.
  • if something is omit, it’s a year. parsedate.rb
    supports “Aug 30”, “30 Aug”, MM/DD and MMDD.
  • slash-splitted format is parsed as ‘month/mday/year’ or
    ’month/mday’ (american format).
  • ‘foo/bar’ should be ‘month/mday’, not ‘year/month’

Funaba writes more details of parsedate:
http://www.funaba.org/date2/parsedate.html (in Japanese)

Regards,

TAKAHASHI ‘Maki’ Masayoshi E-mail: maki@rubycolor.org

Does this mean time.rb no longer supports year/month?

Paul

···

On Sat, Sep 06, 2003 at 10:15:54AM +0900, TAKAHASHI Masayoshi wrote:

[ruby-dev:21292] parsedate.rb and time.rb

Tadayoshi Funaba, the maintainer of parsedate.rb, pointed out
parsedate.rb doesn’t support ‘year/month’ format but time.rb does.
He thought parsedate.rb should not support that format.
Tanaka Akira, the maintainer of time.rb, agreed and fixed
time.rb.