[#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:
"Akinori MUSHA" <knu@...>
Date:
2002-09-04 03:44:40 UTC
List:
ruby-core #426
Hello,
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.
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?
Would you elaborate? Such bugs must be addressed and made detectable
by adding proper tests to the test suite.
> def ==(set)
> equal?(set) and return true
> -
> - set.is_a?(type) && size == set.size or return false
> -
> - set.each { |o| include?(o) or return false }
> -
> - true
> + unless Set === set and size == set.size
> + false
> + else
> + all? { |e| set.include?(e) }
> + end
> end
Good catch. It was my overlook to have missed a case like this:
class SetWithOrder < Set
...
end
class SetWithCondition < Set
...
end
a = SetWithOrder.new([3,2,1])
b = SetWithCondition.new(1..10) { |e| e <= 3 }
a == b # should be true
> + def test_eql?
> + a = EqlClass.new
> + b = EqlClass.new until b.hash == a.hash
> + assert !(Set[a].eql?(Set[b]))
> + end
This is not eql?() is expected to be. The only requirement to eql?()
is make (a == b => a.eql?(b)) always true; in other words, guarantee
(!a.eql?(b) => a != b). See how Hash compares keys: PTR_NOT_EQUAL()
in st.c.
In addition, it is also desirable that eql?() is not too a heavy
function to call frequently, so aliasing eql?() to ==() is not likely
to be a nice idea. (I'd doubt Set is suitable for Hash keys anyway,
though)
> --- == 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
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)
> 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 })
Thanks for all these suggestions, I much appreciate.
Regards,
--
/
/__ __ Akinori.org / MUSHA.org
/ ) ) ) ) / FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp
"When I leave I don't know what I'm hoping to find
When I leave I don't know what I'm leaving behind.."