[#10492] Ruby 1.8.6 preview3 has been released — "Akinori MUSHA" <knu@...>

Hi,

26 messages 2007/03/04
[#10500] Re: Ruby 1.8.6 preview3 has been released — Hugh Sasse <hgs@...> 2007/03/05

On Mon, 5 Mar 2007, Akinori MUSHA wrote:

[#10507] Dynamic Array#join with block — <noreply@...>

Patches item #9055, was opened at 2007-03-05 19:57

12 messages 2007/03/05
[#10520] Re: [ ruby-Patches-9055 ] Dynamic Array#join with block — Nobuyoshi Nakada <nobu@...> 2007/03/06

Hi,

[#10594] grave bug in 1.8.6's thread implementation — Sylvain Joyeux <sylvain.joyeux@...4x.org>

In ext/thread/thread.c, remove_one leaves the list in an inconsistent state.

15 messages 2007/03/14
[#10596] Re: [PATCH] grave bug in 1.8.6's thread implementation — MenTaLguY <mental@...> 2007/03/14

On Thu, 15 Mar 2007 00:15:57 +0900, Sylvain Joyeux <sylvain.joyeux@m4x.org> wrote:

[#10597] Re: [PATCH] grave bug in 1.8.6's thread implementation — Sylvain Joyeux <sylvain.joyeux@...4x.org> 2007/03/14

> > The fix is in thread-mutex-remove_one.diff.

[#10598] Re: [PATCH] grave bug in 1.8.6's thread implementation — MenTaLguY <mental@...> 2007/03/14

On Thu, 15 Mar 2007 01:19:04 +0900, Sylvain Joyeux <sylvain.joyeux@m4x.org> wrote:

[#10599] Re: [PATCH] grave bug in 1.8.6's thread implementation — Sylvain Joyeux <sylvain.joyeux@...4x.org> 2007/03/14

On Wednesday 14 March 2007 17:29, MenTaLguY wrote:

[#10600] Re: [PATCH] grave bug in 1.8.6's thread implementation — MenTaLguY <mental@...> 2007/03/14

On Thu, 15 Mar 2007 01:48:42 +0900, Sylvain Joyeux <sylvain.joyeux@m4x.org> wrote:

[#10615] Multiton in standard library — TRANS <transfire@...>

Hi--

16 messages 2007/03/15
[#10619] Re: Multiton in standard library — Tom Pollard <tomp@...> 2007/03/16

[#10620] Re: Multiton in standard library — TRANS <transfire@...> 2007/03/16

On 3/15/07, Tom Pollard <tomp@earthlink.net> wrote:

[#10646] Marshal.dump shouldn't complain about singletons if the _dump method is defined — <noreply@...>

Bugs item #9376, was opened at 2007-03-19 15:58

12 messages 2007/03/19
[#10647] Re: [ ruby-Bugs-9376 ] Marshal.dump shouldn't complain about singletons if the _dump method is defined — Urabe Shyouhei <shyouhei@...> 2007/03/19

noreply@rubyforge.org wrote:

[#10648] Re: [ ruby-Bugs-9376 ] Marshal.dump shouldn't complain about singletons if the _dump method is defined — Sylvain Joyeux <sylvain.joyeux@...4x.org> 2007/03/19

On Monday 19 March 2007 18:01, Urabe Shyouhei wrote:

[#10651] Re: [ ruby-Bugs-9376 ] Marshal.dump shouldn't complain about singletons if the _dump method is defined — Yukihiro Matsumoto <matz@...> 2007/03/19

Hi,

[#10665] Re: [ ruby-Bugs-9376 ] Marshal.dump shouldn't complain about singletons if the _dump method is defined — "Chris Carter" <cdcarter@...> 2007/03/20

On 3/19/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

[#10712] Ruby Method Signatures (was Re: Multiton in standard library) — "Rick DeNatale" <rick.denatale@...>

On 3/19/07, TRANS <transfire@gmail.com> wrote:

10 messages 2007/03/21
[#10715] Re: Ruby Method Signatures (was Re: Multiton in standard library) — Jos Backus <jos@...> 2007/03/22

On 3/19/07, TRANS <transfire@gmail.com> wrote:

[#10798] Virtual classes and 'real' classes -- why? — "John Lam (CLR)" <jflam@...>

I was wondering if someone could help me understand why there's a parallel =

12 messages 2007/03/28
[#10799] Re: Virtual classes and 'real' classes -- why? — MenTaLguY <mental@...> 2007/03/28

On Thu, 29 Mar 2007 04:44:16 +0900, "John Lam (CLR)" <jflam@microsoft.com> wrote:

Re: Module re-inclusion in 1.9 vs 1.8

From: "Rick DeNatale" <rick.denatale@...>
Date: 2007-03-02 16:25:11 UTC
List: ruby-core #10483
On 3/2/07, Pit Capitain <pit@capitain.de> wrote:
> Rick DeNatale schrieb:
> > Some months ago I noticed that the semantics of module inclusion had
> > changed in 1.9 so that if a subclass reincluded a module which was
> > included by one of its superclasses the module would be reinserted in
> > the inheritance chain.
> > (...)
> > Today I refreshed 1.9 and noticed that this seems to have gone away:
> > (...)
> > Was this a conscious decision?  Personally I would argue for the
> > previous semantics.
>
> FWIW, if the module inclusion semantics would be changed to allow
> multiple occurrences of a module in the inheritance chain, we should be
> able to fix the following problem, mentioned for example in [ruby-core:2013]
>
>    module EnumerableAddOns
>      def sum
>        inject(0) { |s, n| s += n }
>      end
>    end
>
>    module Enumerable
>      include EnumerableAddOns
>    end
>
>    p [ 1, 2, 3, 4 ].sum  # => undefined method `sum' (NoMethodError)

This is a different issue I believe.

What's happening here, as far as I can see is that when you include a
module into another module or class, a chain of pseudo-classes is
created which parallels the ancestor chain of the included module.
Note that this ancestor chain can only include modules since modules
can only have modules as super.

The implementation marks each of these pseudo classes as a T_ICLASS
(included class).  Each of these pseudo-class points to the method and
iv_tables of the associated module. The whole chain is then inserted
between the including class and it's existing super.

So if you change the methods of the module, or add a class instance
variable, this affects all of the classes/modules including it since
the pseudo-classes all reference the method and iv tables, but
including another module in a module has no effect on existing
inclusions of that module.

To make that work would require keeping track of, or searching for all
existing inclusions of a module and relinking the super chain when a
change was made to which modules it includes.  There are a few other
quirks like this in Ruby, where some changes don't affect prior
history. I was just told about one last night at our local ruby
brigade hack night, by Nathaniel Talbott relative to class variables:

rick@frodo:/public/rubyscripts$ cat civtest.rb
class C1; end
class C2 < C1; @@c = :c2; p @@c; end
class C1; @@c = :c1; p @@c; end
class C2; p @@c; end
rick@frodo:/public/rubyscripts$ ruby1.8 civtest.rb
:c2
:c1
:c2
rick@frodo:/public/rubyscripts$ ruby1.9 civtest.rb
:c2
:c1
:c2


Note that had @@c been created in the superclass first, it would have
been the same variable as in the subclass.

Now the issue which prompted this thread is that when a module is
included, the implementation searches up the existing anscestor chain,
and if it finds a pseudo-class which represents the module being
included; which it determines by comparing the method table pointers;
it ignores the request to re-include the module.

1.9 used to allow re-inclusion but the current version doesn't.  It
seems to me that this would be a safe change, at least from the
semantics, since existing code shouldn't be using re-inclusion since
it doesn't work, and it could be useful.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

In This Thread