[#25897] Mail archive searching? — "Martin J. Dürst" <duerst@...>
Why does ruby-dev's official archive
[#25928] Ruby 1.8.6-p383 hangs in dln_load on Snow Leopard — Timothy Hunter <cyclists@...>
An RMagick user reports that Ruby 1.8.6 hangs when requiring RMagick.
On Oct 3, 2009, at 4:26 PM, Timothy Hunter wrote:
On Oct 3, 10:26=A0pm, Timothy Hunter <cycli...@nc.rr.com> wrote:
[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>
Hi,
On Sun, Oct 4, 2009 at 11:47 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrot=
[#25943] Disabling tainting — Tony Arcieri <tony@...>
Would it make sense to have a flag passed to the interpreter on startup that
Tony Arcieri wrote:
2009/10/6 Tony Arcieri <tony@medioh.com>:
On Tue, Oct 6, 2009 at 3:52 AM, Yugui <yugui@yugui.jp> wrote:
[#25964] mis filed bug reports — Roger Pack <rogerdpack2@...>
If i accidentally file a bug under 1.9 that belongs in 1.8, I assume I
[#25965] [Bug #2180] request: add *Method#source_location to 1.8.x — Roger Pack <redmine@...>
Bug #2180: request: add *Method#source_location to 1.8.x
[#25969] [Bug #2181] Segmentation fault for test/drb/* -- possible bug in Marshal/GC — Nikolai Lugovoi <redmine@...>
Bug #2181: Segmentation fault for test/drb/* -- possible bug in Marshal/GC
[#26012] Segfaults after multiple call of ruby_node_run — Christoph Kappel <unexist@...>
[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>
Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error
[#26070] [Bug #2201] Process.spawn fails in 1.9.1 — Roger Pack <redmine@...>
Bug #2201: Process.spawn fails in 1.9.1
[#26087] [Bug #2212] Using a Lambda with Inappropriate Arity for Hash#default_proc= — Run Paint Run Run <redmine@...>
Bug #2212: Using a Lambda with Inappropriate Arity for Hash#default_proc=
[#26126] The fate of my keyword documentation — "David A. Black" <dblack@...>
Hi --
[#26200] [Bug #2243] Random instance variables order — Maxim Chechel <redmine@...>
Bug #2243: Random instance variables order
[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>
Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds
[#26232] [Feature #2255] unicode parameters cannot be passed to ruby — Vit Ondruch <redmine@...>
Feature #2255: unicode parameters cannot be passed to ruby
[#26237] [Bug #2256] net\ftp.rb failing on implicit cast of Pathname to string — Sai Fujinaro <redmine@...>
Bug #2256: net\ftp.rb failing on implicit cast of Pathname to string
[#26262] [Feature #2260] better access with GC_DEBUG — Roger Pack <redmine@...>
Feature #2260: better access with GC_DEBUG
[#26299] Which commit fixed Set#hash (Hash#hash, I assume) between 1.9.1 and 1.9.2? — "Shot (Piotr Szotkowski)" <shot@...>
Hello, good people of ruby-core.
[#26303] IO.foreach (and friends) effect on $< and $. — Charles Oliver Nutter <headius@...>
I have a few questions about how the line-by-line IO operations are
[#26336] [Bug #2283] Ruby 1.9.1p243 spinning with 100% CPU; perhaps rb_str_slice_bang-related — Mark Aiken <redmine@...>
Bug #2283: Ruby 1.9.1p243 spinning with 100% CPU; perhaps rb_str_slice_bang-related
[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>
Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine
Issue #2294 has been updated by Anonymous Anonymous.
Hi,
Hi,
Hi,
[#26388] suggestion: gems.ruby-lang.org — Yusuke ENDOH <mame@...>
Hi --
On Wed, Oct 28, 2009 at 3:20 AM, Yusuke ENDOH <mame@tsg.ne.jp> wrote:
Hi,
On Wed, Oct 28, 2009 at 9:00 PM, Yusuke ENDOH <mame@tsg.ne.jp> wrote:
Hi,
[#26390] [Bug #2303] dl.so segfaults on mingw32 — Nikolai Weibull <redmine@...>
Bug #2303: dl.so segfaults on mingw32
[#26429] [Bug #2313] Incomplete encoding conversion? — Adam Salter <redmine@...>
Bug #2313: Incomplete encoding conversion?
[#26447] [Bug #2316] [BUG] cfp consistency error — Cezary Baginski <redmine@...>
Bug #2316: [BUG] cfp consistency error
[#26458] [Bug #2319] gethostbyname fails in windows — Roger Pack <redmine@...>
Bug #2319: gethostbyname fails in windows
[#26459] [Bug #2320] patch to trunk .document to include more readme's etc. — Roger Pack <redmine@...>
Bug #2320: patch to trunk .document to include more readme's etc.
[ruby-core:25888] Re: struggling to convince myself 1.9's constant lookup rules make any sense
On Oct 1, 8:47=A0am, "David A. Black" <dbl...@rubypal.com> wrote:
> Hi --
>
>
>
>
> First thought: because the purpose of the rule, I think, is to clarify
> that there's a distinction, and the cost of that clarification is that
> it's a mistake not to make the distinction.
>
> For example:
>
> class C
> =A0 =A0def self.run(&block)
> =A0 =A0 =A0class_eval(&block)
> =A0 =A0end
> end
>
> class D
> =A0 =A0MyConst =3D 1
> =A0 =A0C.run { p MyConst }
> end
>
> That code will give you "unknown constant C::MyConst" in 1.9. The
> reasoning, as I understand it, is that the caller cannot depend one
> way or the other on whether there's a constant called MyConst in the
> evaluating class. In other words, there could be:
>
> =A0 =A0class C
> =A0 =A0 =A0MyConst =3D 2
>
> etc., in which case the call from D would not use D::MyConst -- so
> since D has no jurisdiction over whether C::MyConst exists, the only
> consistent approach is to assume that C will *always* have the
> responsibility for resolving MyConst.
>
hrm. i don't really see it that way, at least it seems directly
opposed to how this runs, which prints '1' in both 1.8 and 1.9
cfp:~ > cat a.rb
class C
def C.run(&block) class_eval(&block) end
def C.myConst() 2 end
end
class D
myConst =3D 1
C.run { p myConst }
end
cfp:~ > ruby18 a.rb
1
cfp:~ > ruby19 a.rb
1
here the rule is *clearly* that the closure's scope comes before the
caller's scope. but not that it is *not* an exclusive scope - a
failure to to a lookup on the closure the falls to the caller:
cfp:~ > cat a.rb
class C
def C.run(&block) class_eval(&block) end
def C.myConst() 2 end
end
class D
C.run { p myConst }
end
cfp:~ > ruby18 a.rb
2
cfp:~ > ruby19 a.rb
2
my proposal is that const look up could work this way:
cfp:~ > cat a.rb
class C
def C.run(&block)
with_scope(block){ class_eval(&block) }
end
def C.with_scope(scope, &block)
@scope =3D scope
block.call
ensure
@scope =3D nil
end
def C.const_missing(const)
@scope ? eval(const, @scope.binding) : super
end
end
class D
MyConst =3D 42
C.run { p MyConst }
end
cfp:~ > ruby18 a.rb
42
cfp:~ > ruby19 a.rb
42
that is to say "prefer the caller but fall back to the closure."
that seems very POLS, for definitions of POLS that involve
'I'=3D=3Dara.t.howard ;-)
> It reminds me (maybe not one-to-one, but generally) of the
> instance_eval thing with instance variables:
>
> class E
> =A0 =A0def x(&block)
> =A0 =A0 =A0@x =3D 1
> =A0 =A0 =A0instance_eval(&block)
> =A0 =A0end
> end
>
> @x =3D 2
> p E.new.x { @x } =A0 =A0# 1
>
> Here, since instance variables are always resolved via self, the @x in
> the block is always the @x of the E instance. (I'm not a big fan of
> the stealth instance_eval, for what it's worth.) I think something
> analogous is (now) going on with constants.
>
yes, it's similarly confusing i agree.
> (I do not mean that self is the same as an enclosing class, nor that
> instance variables are the same as constants, nor anything else that I
> didn't say unless it's very insightful and brilliant :-)
>
> I'm not sure about how this plays out with regard to the technical
> definition of a closure. I've always taken it to mean the local
> variable bindings, and not necessarily the rest of the runtime state.
>
the fact that you have always been able to do
caller =3D eval 'self', block
leads me to believe it's deliberately meant to be much much more in
ruby.
cheers.