From: Anuj Dutta Date: 2011-10-03T01:02:47+09:00 Subject: [ruby-core:39834] Re: Discussion results --20cf3040e3be2eb2a004ae52fd59 Content-Type: text/plain; charset=ISO-8859-1 Hello all, Thanks for the write-up. 2011/10/2 SASADA Koichi > Hi, > > We made a discuss tonight, the last day of RubyConf 2011 about 2.0 > features and several conclusion. > > I send a memo of discussion. I hope it will boost a process toward 2.0. > > > * Module#prepend and Module#mix > > - Module#mix => rejected > - Module#prepend > > # Sorry, I can't write the discussion why we decide this specification. > > class C0; > def foo; :C0; end > end > > module M > def foo; :m; end > end > > class C1 < C0 > prepend M > def foo; :C1; end > end > > C.ancestors #=> [M, C1, C0, Object] > C.new.foo > > C1.new.foo #=> :m > C1.remove_method(:foo) > C1.new.foo #=> :m > C1.new.foo #=> C0 > > * Allow duplication in same module in ancestor tree > > module M0; end > module M1; include M0; end > module M2; prepend M0; end > > class C > include M0 > prepend M1 > include M2 > prepend M0 > end > > # Mx@My means Mx module included/prepended by My > C.ancestors #=> [M0, M1, M0@M1, C, M0@M2, M2, M0, Object] > > IMHO, any "prepended module" is not part of the returned ancestors list because they are not really ancestors. Instead the class that prepends the module is in that prepended module's ancestoral chain, correct? Here's what it would look like: module M0; end module M1; end class C include M0 prepend M1 end C.ancestors #=> [C, M0, Object] M0.ancestors #=> [M0] M1.ancestors #=> [M1, C] A new method should be introduced to give the list of all the prepended modules. For example: C.prependors #=> [M1] I am not sure if this is possible or not as I have no knowledge of ruby's internal implementations but had a thought and just throwing it out there. Thanks. Anuj * Object#confirm_to?([an array of symbols]) > > It is same as: > [an array of symbols].all?{|sym| > obj.respond_to? sym > } > > * %s(foo bar) or %S(foo bar) notation > > Same as [:foo, :bar]. %s and %S is same as %w and %W? > > * Method#source_location > > Return also begin and end position in file. You can get source code > using it. We don't decide how to return this location. > > def m; end > p method(:m).source_location > #=> [file, line, beg, end] > # or > #=> [file, line, (beg .. end)] > # or others? > > * Float literal (1.0 or 3.2 or something) should return Rational object > or not? > > ex) 1.3 #=> Rational(3, 10) > 1/2 #=> 0 (not changed integer division) > 1/2.0 #=> Rational > 1.fdiv(2) #=> 0.5 > > Matz like this idea. But it has compatibility issue? > > (not concluded) > > * nonblocking I/O > > not concluded. > > - Exception (EEOF etc) is too heavy for Rails app. > - We need more lightweight exception object creation. > > * Threading (remove GVL or GIL) > > We don't remove GVL on 2.0. > > > -- > // SASADA Koichi at atdot dot net > > -- Anuj DUTTA --20cf3040e3be2eb2a004ae52fd59 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello all,

Thanks for the write-up.

2011/10/2 SASADA Koichi <ko1@atdot.net>
Hi,

We made a discuss tonight, the last day of RubyConf 2011 about 2.0
features and several conclusion.

I send a memo of discussion. =A0I hope it will boost a process toward 2.0.<= br>

* Module#prepend and Module#mix

- Module#mix =3D> rejected
- Module#prepend

# Sorry, I can't write the discussion why we decide this specification.=

=A0class C0;
=A0 =A0def foo; :C0; end
=A0end

=A0module M
=A0 =A0def foo; :m; end
=A0end

=A0class C1 < C0
=A0 =A0prepend M
=A0 =A0def foo; :C1; end
=A0end

=A0C.ancestors #=3D> [M, C1, C0, Object]
=A0C.new.foo

=A0C1.new.foo #=3D> :m
=A0C1.remove_method(:foo)
=A0C1.new.foo #=3D> :m
=A0C1.new.foo #=3D> C0

* Allow duplication in same module in ancestor tree

=A0module M0; end
=A0module M1; include M0; end
=A0module M2; prepend M0; end

=A0class C
=A0 =A0include M0
=A0 =A0prepend M1
=A0 =A0include M2
=A0 =A0prepend M0
=A0end

=A0# Mx@My means Mx module included/prepended by My
=A0C.ancestors #=3D> [M0, M1, M0@M1, C, M0@M2, M2, M0, Object]


IMHO, any "prepended module" is not par= t of the returned ancestors list because they are not really ancestors. Ins= tead the class that prepends the module is in that prepended module's a= ncestoral chain, correct?

Here's what it would look like:

module M0; end
module M1; end

class C
=A0 include M0
=A0 prepend M1
end

C.ancestors=A0= =A0=A0 #=3D> [C, M0, Object]
M0.ancestors=A0 #=3D> [M0]
M1.ance= stors=A0 #=3D> [M1, C]

A new method should be introduced to give = the list of all the prepended modules. For example:

C.prependors #=3D> [M1]

I am not sure if this is possible or = not as I have no knowledge of ruby's internal implementations but had a= thought and just throwing it out there.

Thanks.

Anuj


* Object#confirm_to?([an array of symbols])

It is same as:
=A0[an array of symbols].all?{|sym|
=A0 =A0obj.respond_to? sym
=A0}

* %s(foo bar) or %S(foo bar) notation

Same as [:foo, :bar]. =A0%s and %S is same as %w and %W?

* Method#source_location

Return also begin and end position in file. =A0You can get source code
using it. =A0We don't decide how to return this location.

=A0def m; end
=A0p method(:m).source_location
=A0 =A0#=3D> [file, line, beg, end]
=A0 =A0# or
=A0 =A0#=3D> [file, line, (beg .. end)]
=A0 =A0# or others?

* Float literal (1.0 or 3.2 or something) should return Rational object
or not?

=A0ex) 1.3 #=3D> Rational(3, 10)
=A0 =A0 =A01/2 #=3D> 0 (not changed integer division)
=A0 =A0 =A01/2.0 #=3D> Rational
=A0 =A0 =A01.fdiv(2) #=3D> 0.5

Matz like this idea. =A0But it has compatibility issue?

(not concluded)

* nonblocking I/O

not concluded.

- Exception (EEOF etc) is too heavy for Rails app.
- We need more lightweight exception object creation.

* Threading (remove GVL or GIL)

We don't remove GVL on 2.0.


--
// SASADA Koichi at atdot dot net




--
Anuj DUTTA
--20cf3040e3be2eb2a004ae52fd59--