[#44776] [ruby-trunk - Bug #6385][Open] mtime vie File.stat(filename).utime vs File.open(filename, 'r').mtime in Windows — "kolmanv (Kolman Vornovitsky)" <kolmanv@...>

9 messages 2012/05/01

[#44782] [ruby-trunk - Bug #6387][Open] 1.9.3p194 crashed on require in ubuntu — "ywen (Yi Wen)" <hayafirst@...>

12 messages 2012/05/01

[#44795] [ruby-trunk - Bug #6391][Open] Segment Fault while execute make_encmake.rb for Ruby 1.9.3 P194 ( MinGW64) — "raylinn@... (ray linn)" <raylinn@...>

13 messages 2012/05/02

[#44911] [ruby-trunk - Bug #6408][Open] DelegateClass#eql? and <=> don't work as expected — "tenderlovemaking (Aaron Patterson)" <aaron@...>

11 messages 2012/05/06

[#44951] [ruby-trunk - Feature #6414][Open] Destructuring Assignment — "edtsech (Edward Tsech)" <edtsech@...>

14 messages 2012/05/08

[#44958] [ruby-trunk - Feature #6418][Assigned] Supporing a subset of ANSI escape code on Windows — "usa (Usaku NAKAMURA)" <usa@...>

11 messages 2012/05/09

[#45035] [ruby-trunk - Bug #6433][Open] rb_thread_blocking_region(): ubf() function is executed with GVL — ibc (Iñaki Baz Castillo) <ibc@...>

12 messages 2012/05/14

[#45180] [ruby-trunk - Feature #6478][Open] BasicObject#__class__ — "trans (Thomas Sawyer)" <transfire@...>

14 messages 2012/05/22

[#45193] [ruby-trunk - Feature #6482][Open] Add URI requested to Net::HTTP request and response objects — "drbrain (Eric Hodel)" <drbrain@...7.net>

16 messages 2012/05/23

[#45198] [ruby-trunk - Feature #6483][Open] parametric map — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

14 messages 2012/05/23

[#45222] [ruby-trunk - Feature #6492][Open] Inflate all HTTP Content-Encoding: deflate, gzip, x-gzip responses by default — "drbrain (Eric Hodel)" <drbrain@...7.net>

23 messages 2012/05/24

[#45252] [ruby-trunk - Feature #6499][Open] Array::zip — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

14 messages 2012/05/26

[#45272] [ruby-trunk - Feature #6503][Open] Support for the NPN extension to TLS/SSL — "igrigorik (Ilya Grigorik)" <ilya@...>

13 messages 2012/05/27

[#45316] [ruby-trunk - Feature #6515][Open] array.c: added method that verifies if an Array is part of another — "lellisga (Li Ellis Galardo)" <lellisga@...>

14 messages 2012/05/30

[ruby-core:45000] Re: [ruby-trunk - Feature #5632] Attempt to open included class shades it instead.

From: Benoit Daloze <eregontp@...>
Date: 2012-05-11 19:32:37 UTC
List: ruby-core #45000
On 9 May 2012 13:49, boris_stitnicky (Boris Stitnicky)
<boris@iis.sinica.edu.tw> wrote:
>
> Issue #5632 has been updated by boris_stitnicky (Boris Stitnicky).
>
>
> Back to the original issue, having
> module A; class X; def hello; puts 'hello' end end end
> module B; include A end
>
> then using "class X" statement inside B module does not behave as you say,
> "X = defined?(X) ? X : Class.new", but as
> "X = self.constants(false).include?(:X) ? X : Class.new",

Indeed, that's what I wanted to say, thanks for finding my error.

> From retrospective, there are 3 logically justified behaviors for "class Transition"
> statement in this situation:
>
> 1. Opening the ancestor's class, explicitly:
> class Petri::Transition; # do modifications
> end
> This is most "logical", because Transition constant is already there, but
> opening ancestor's assets in offspring modules is hardly a good habit.
> 2. Creation of a brand new class, explicitly:
> Transition = Class.new; class Transition; # do modifications
> end
> Less logical, but justifiable behavior, encouraging bad habits less.
> 3. Operation on a subclass, explicitly:
> class Transition < Transition; # do modifications
> end
> Perhaps least logical, but I suspect that most frequently needed behavior.

I would not want the class keyword without "< ParentClass" to inherit
from anything else than Object.

The main class keyword use is to create a class, so it makes sense to
me it reopens only if it is in the strictly same context
(self.constants(false)).
But I'll agree with you "class X < X" is rather confusing. I would
rather write it "class Transition < Petri::Transition" in your case,
to be clear on the intention.

I believe a good documentation on constants would be a great addition.

In This Thread