Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ruby-dev suumary 26862-26956

0 views
Skip to first unread message

Masayoshi Takahashi

unread,
Sep 14, 2005, 8:56:31 PM9/14/05
to
Hi all,

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


[ruby-dev:26869] [Oniguruma] Version 3.8.9

K.Kosako announced that new Oniguruma was released.


[ruby-dev:26881] Re: Failure: test_block_passing(TestIterator)

Kazuhiro NISHIYAMA reported that test_block_passing(TestIterator)
on ruby chkbuild (automated build test) fails in 1.8 and 1.9.

http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-1.8/last
http://www.rubyist.net/~akr/chkbuild/debian-sarge/ruby-trunk/last

Nobuyoshi Nakada said that he was still considering.


[ruby-dev:26895] Enumerable#count

Satoru Takabayashi wrote a table of methods of Array
in Ruby, Python, JavaScript, Perl and C.

http://namazu.org/~satoru/blog/archives/000043.html

When he wrote it, he found that Ruby doesn't have
a method such as a.count(x) in Python. He wanted
to add Enumerable#count into Ruby.

But in his next mail, he found that Enumerable#nitems
has block like a.nitems{|e| e == x}. He guessed it
may be enough to do.


[ruby-dev:26900] multiplying empty string

Nobuyoshi Nakada asked whether it is a feature that
"x".taint * 0 is tainted when "x" is tainted. Matz
answered that it is by design and it should be not
problem, but Tanaka Akira doubted it (he is really
interested in taint model and its security).


[ruby-dev:26924] enumerator

Nobuyoshi Nakada made a patch to return Enumerator
object when Enumerable method is called without
block. It's applied to each or each-like methods
in Array, Dir, Hash, IO, Range, String and Struct.

http://www.rubyist.net/~nobu/ruby/enumerator.diff


Regards,

Masayoshi 'Maki' Takahashi E-mail: ma...@rubycolor.org


Austin Ziegler

unread,
Sep 15, 2005, 1:38:30 PM9/15/05
to
On 9/14/05, Masayoshi Takahashi <ma...@rubycolor.org> wrote:
> [ruby-dev:26895] Enumerable#count
>
> Satoru Takabayashi wrote a table of methods of Array
> in Ruby, Python, JavaScript, Perl and C.
>
> http://namazu.org/~satoru/blog/archives/000043.html
>
> When he wrote it, he found that Ruby doesn't have
> a method such as a.count(x) in Python. He wanted
> to add Enumerable#count into Ruby.
>
> But in his next mail, he found that Enumerable#nitems
> has block like a.nitems{|e| e == x}. He guessed it
> may be enough to do.

I think that it would not be a bad idea to add Enumerable#count as an
alias for Enumerable#nitems, as while #nitems is somewhat sensible, it
doesn't leap out as a "count items that are like this" method to me. I
would tend to favour #select with #size or #inject if said method does
not exist.

> [ruby-dev:26924] enumerator
> Nobuyoshi Nakada made a patch to return Enumerator
> object when Enumerable method is called without
> block. It's applied to each or each-like methods
> in Array, Dir, Hash, IO, Range, String and Struct.
>
> http://www.rubyist.net/~nobu/ruby/enumerator.diff

Um. Any chance of seeing this in Ruby 1.8.x? I'm supposing this is
instead of a LocalJumpError.

-austin
--
Austin Ziegler * halos...@gmail.com
* Alternate: aus...@halostatue.ca


Florian Groß

unread,
Sep 15, 2005, 3:31:56 PM9/15/05
to
Austin Ziegler wrote:

> I think that it would not be a bad idea to add Enumerable#count as an
> alias for Enumerable#nitems, as while #nitems is somewhat sensible, it
> doesn't leap out as a "count items that are like this" method to me. I
> would tend to favour #select with #size or #inject if said method does
> not exist.

Why not? I read it as "number of items" so being able to use a block
seems natural.

#count might still be a good idea, though -- I think people are going to
try #count first.

nobu....@softhome.net

unread,
Sep 15, 2005, 5:52:56 PM9/15/05
to
Hi,

At Fri, 16 Sep 2005 02:38:30 +0900,
Austin Ziegler wrote in [ruby-talk:156292]:


> > [ruby-dev:26924] enumerator
> > Nobuyoshi Nakada made a patch to return Enumerator
> > object when Enumerable method is called without
> > block. It's applied to each or each-like methods
> > in Array, Dir, Hash, IO, Range, String and Struct.
> >
> > http://www.rubyist.net/~nobu/ruby/enumerator.diff
>
> Um. Any chance of seeing this in Ruby 1.8.x? I'm supposing this is
> instead of a LocalJumpError.

It would be radical change for stable version, at least 1.8.3.

--
Nobu Nakada


0 new messages