ruby-dev summary 21254-21294

  • Thread starter TAKAHASHI Masayoshi
  • Start date
T

TAKAHASHI Masayoshi

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: (e-mail address removed)
 
P

Paul Brannan

[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.

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

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top