[#413] Should we check alloca ret val? — Michal Rokos <m.rokos@...>
Hi,
7 messages
2002/09/03
[#441] Patch to add a Module#const_missing method — JanArne.Petersen@... (Jan Arne Petersen)
Hi,
11 messages
2002/09/05
[#443] Re: Patch to add a Module#const_missing method
— matz@... (Yukihiro Matsumoto)
2002/09/06
Hi,
[#444] io_write()/fwrite() and EINTR on Solaris — Jos Backus <jos@...>
I am encountering a problem similar to the one mentioned here,
19 messages
2002/09/06
[#453] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/09/08
Hi,
[#454] Re: io_write()/fwrite() and EINTR on Solaris
— matz@... (Yukihiro Matsumoto)
2002/09/09
Hi
[#469] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/09
On Mon, Sep 09, 2002 at 03:55:13PM +0900, Yukihiro Matsumoto wrote:
[#479] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/10
On Tue, Sep 10, 2002 at 01:04:10AM +0900, Jos Backus wrote:
[#492] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/21
On Wed, Sep 11, 2002 at 02:23:33AM +0900, Jos Backus wrote:
[#495] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/09/21
Hi,
[#496] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/09/21
Hello,
[#564] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/11/06
On Sun, Sep 22, 2002 at 04:24:31AM +0900, Jos Backus wrote:
[#566] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/11/07
Hi,
[#567] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/11/07
On Thu, Nov 07, 2002 at 01:43:03PM +0900, nobu.nokada@softhome.net wrote:
[#568] Re: io_write()/fwrite() and EINTR on Solaris
— nobu.nokada@...
2002/11/07
Hi,
[#569] Re: io_write()/fwrite() and EINTR on Solaris
— Jos Backus <jos@...>
2002/11/07
On Thu, Nov 07, 2002 at 03:49:51PM +0900, nobu.nokada@softhome.net wrote:
[#449] ruby.h, string.c — Michal Rokos <m.rokos@...>
Hello,
7 messages
2002/09/06
[#459] Parse.y — Michal Rokos <m.rokos@...>
Hi,
6 messages
2002/09/09
[#461] Related to [Memleak] in sprintf.c — Michal Rokos <m.rokos@...>
Hi,
5 messages
2002/09/09
[#508] can java applications invoke ruby scripts?? — "John Davis" <javaccnews@...>
I want to know if Java applications can invoke ruby scripts?? In other
8 messages
2002/09/26
RE: Set.rb patch
From:
"Christoph" <chr_news@...>
Date:
2002-09-04 09:55:19 UTC
List:
ruby-core #430
Akinori MUSHA
...
> I'd appreciate your patch, but next time would you please separate
> real changes from irrelevant style fixes? It is so tough for me to
> read a patch which is a mixture of style fixes (whitespace adjustments
> especially) and relevant changes. I have my own taste in coding and
> you have your own, so it is natural that they can conflict in some
> places. For example, I prefer obj.is_a?(Klass) to Klass === obj
> because I think the former is more readable, but you may have your own
> opinion.
Yes, the style thing is really stupid - I actually forgot that the
patch contained these changes ... for white spaces I'll pass the
bucket and blame it on my editor;-)
>
> However, I guess I could accept some/many of the improvements like
> using all?, improvements on _flatten(), and so on.
>
> > the included patch set.rb.diff resolves bugs in initialize,
> > flatten(!), eql?
Your initialize method accepts a false argument
Set.new(false) == Set[]
Is this intentional? In the loop detection you never back
out ids from your ``already seen'' Set. This can cause
a false positive ``loop alarm''. I'll try to answer
the `` eql?, =='' question(s) in a second email.
>
> Would you elaborate? Such bugs must be addressed and made detectable
> by adding proper tests to the test suite.
I did add tests to all (perceived) buglets.
>
>
...
> > --- == set
> > Returns true if two sets are equal. The equality of each
couple
> > - of elements is defined according to Object#eql?.
> > + of elements is defined according to Object#==.
>
> I'm afraid this change is wrong. Note that it is saying about
Sorry, a leftover from a first reading ...
> comparison of elements. As long as it uses Set#include?, comparison
> is done using Object#eql?.
>
> > + Comparable
> > + def <=>(o)
>
> Isn't it good enough to have ==() and contain?() (which does <=/=>) ?
> I didn't mark Set as Comparable because I couldn't think of a case
> where < and > are useful, when a > b raises an exception if a.<=>(b)
> returns nil. (and your implementation does)
The Comparable semantics recently changed. A ``nil'' return of
a <=> b
signifies that a,b are incomparable, in other words
a < b, a == b and b > a
will return false - in particular no exception is raised - e.g.
(with my modification) you'll find that
p Set[1,2] < Set[2,3] # false.
I also like to point out that sub(super)set relation is the
prototypical example for a ``partial order''. In fact, the new
Comparable semantics was probably introduced with classes like
Set in mind.
>
> > and adds a block option to initialize and contain?.
>
> I am not sure if it'd be obvious for initialize() and contain?() to
> take an optional block. It could be useful, but how the block is used
> is not very obvious, to me at least. I mean, I just can't grasp at a
> glance what the following piece of code means:
>
> foo.contain?(bar) { |o| o.upcase }
>
> It might be less efficient, but I'd recommend doing like this:
>
> foo.contain?(bar.map { |o| o.upcase })
Think about it. The #contain? together with the #include?
method is probably the single most important Set method
and it ought to be possible to express the efficient
containment test for
foo.contain?(bar.map { |o| o.upcase })
using the Set Class. Admittedly the meaning
foo.contain?(bar) { |o| o.upcase }
needs some time to get used to, however this is no
different to the various block options for the methods
of the other container classes. For example, I always
need to look up that
h = { "a" => 10, "b" => 20 }
h.delete("c") { |e| "prints #{e}" } # prints c.
If the set class does not provide such a functionality
we will end up writing
bar.all? {|x| foo.include?(e.upcase) }
in space or time critical places. Besides, the block
option is good place to distinguish contain? form
<=> ;-)
>
>
> Thanks for all these suggestions, I much appreciate.
And thank you for writing this class - in particular for
implementing the super-cool #divide, #print routines and
the many test cases. I'll try to send a cleaned up patch
(without blocks) later today or tomorrow.
/Christoph