Ah yes I see.
Actually I think we should just use the original version.
Because NameError is what I'd expect it would do.
So in our case where the user has specified a framework to be loaded,
the constant lookup should occur once the framework is loaded, like in
Vincents patch.
Eloy
On Jan 22, 2009, at 8:39 AM, Alexander Flatter wrote:
Hi there,
The extlib's #full_const_get will raise an NameError if there's no
constant found. That's what I changed.
I agree that returning nil is more adequate than false though we
should perhaps stay as near to extlib as possible
and raise exceptions to prevent incompatibilities (think of MacRuby
users that want to use datamapper).
---- SNIP: extlib behaviour ----
class A; class B; end; end
=> nil
A.full_const_get 'A::B'
NameError: uninitialized constant A::A
A.full_const_get 'B'
=> A::B
Object.full_const_get 'A::B'
=> A::B
---- /SNIP ----
Giving some tests back to extlib should be no problem.
On Thu, Jan 22, 2009 at 12:06 AM, Eloy Duran
<eloy.de.en...@gmail.com> wrote:
Hey,
The test looks good to me and I totally agree, false is more
unexpected then
nil in this case.
So then I looked up the tests for it from extlib:
http://github.com/sam/extlib/blob/2bc2e8a42c7a49e2e5daf530c29fb2840d0e299d/spec/object_spec.rb#L29
And it doesn't even test for the case that a constant can't be found.
Anyways, I think we should copy over that existing test and add an
extra one
for when a constant can't be looked up.
In cases/hotcocoa/object_ext_test.rb.
Also, Alexander, you might want to take those changes and tests
upstream
back to extlib.
Cheers,
Eloy
On 21 jan 2009, at 23:33, Vincent Isambart wrote:
Hey,
Attached a patch with the fix. I checked the test and the fix does
indeed
make it pass.
In my change I also changed Object#full_const_get to return nil
(and not
false) when it does not find a constant because false seemed odd
to me. What
do you think?
Cheers
<0001-Fixed-HotCocoa-mapping-after-framework-
load.patch>_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel