[#28561] Ruby::DL vs Ruby::FFI — Aston <blackapache512-ticket@...>

Ruby.DL and FFI libraries are great for programmers like me who are not internet programmers, but are more interested in scientific and number processing etc.

11 messages 2010/03/08

[#28686] trunk (26947) build fail with msys/mingw/vista — Jon <jon.forums@...>

I get the following build failure when msysgit's "c:\git\cmd" dir is on PATH.

8 messages 2010/03/16

[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28482] Question on scoped constant resolution Class vs Module

From: Peter McLain <peter.mclain@...>
Date: 2010-03-04 19:31:39 UTC
List: ruby-core #28482
I asked this on ruby-talk, but didn't get anywhere.  Someone suggested  
I post over here.

Resolution of fully scoped constants behaves differently if there is a  
class versus a module in the name:

   XYZ = 10

   module M
   end

   class C
   end

   p defined? M::XYZ  # => nil
   p defined? C::XYZ  # => "constant"

A few questions:

1: Is this difference intended?
2: If so, what is the rationale?
3: Should defined?(C::XYZ) behave differently than C.const_defined? 
(:XYZ) ?
4: Is the draft ruby spec correct, or MRI behavior correct, or did I  
miss something in the following:

I think the behavior with M::XYZ does not conform to section 11.4.3.2  
of the draft ruby spec:

11.4.3.2
  (a) the primary-expression is M,
  (b) M is a module, do not raise TypeError
  (c 1) XYZ is the constant-identifier
  (c 2) XYZ is not one of the constants defined in M
  (c 3 i) There are no included modules in M (skip)
  (c 3 ii) N/A
  (c 3 iii) Goto step e of section 11.4.3.1

11.4.3.1
  (e) M is not a class
  (e 1) Search Object for a binding for XYZ

So, according to the spec, it looks like M:XYZ should resolve to the  
XYZ in Object and MRI is incorrect to return nil.

Did I miss something?


The real world occurrence of this was:

    return unless defined? RDoc::VERSION # RDoc 1 does not have VERSION
    # code that blows up if RDoc 1 being used...

Which does not currently work in MagLev, since MagLev returns  
"constant" for defined?RDoc::VERSION.  One could argue that the proper  
test, which works for both classes and modules in all ruby  
implementations, is:

    return unless RDoc.const_defined? :VERSION

--  
Peter McLain
peter.mclain@gemstone.com




In This Thread

Prev Next