[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
SXNzdWUgIzEyMTM0IGhhcyBiZWVuIHVwZGF0ZWQgYnkgTWFydGluIETDvHJzdC4KCgpUc3V5b3No
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74385] [Ruby trunk Bug#12109][Rejected] Exception during class load can cause partially-loaded class
From:
ruby-core@...
Date:
2016-03-16 15:29:11 UTC
List:
ruby-core #74385
Issue #12109 has been updated by Marc-Andre Lafortune.
Status changed from Open to Rejected
Closing as this is not a bug.
I don't see any change of the sort happening as both of your expectations make no sense. Please understand that when loading a file, ruby executes them. The statements are executed in order. The `def` could be changed to `define_method` which is not a keyword but an instance method of `Module`.
Is it rails that rescues the exception when autoloading? I can't remember. If so, patch that behavior if you really want to.
----------------------------------------
Bug #12109: Exception during class load can cause partially-loaded class
https://bugs.ruby-lang.org/issues/12109#change-57505
* Author: Matt U
* Status: Rejected
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I noticed this bug using Rails, which lazy-loads classes (via ActiveSupport.)
Here's a minimal test case:
~~~ruby
#!/usr/bin/env ruby
begin
# simulate loading a class from file at runtime
eval %q{
class Foo
def self.bar
fail 'bar'
end
bar
def self.baz
puts 'baz'
end
end
}
rescue => e
puts "rescued: #{e}"
end
# => rescued: bar
Foo.baz
# => undefined method `baz' for Foo:Class (NoMethodError)
~~~
EXPECTED
Either:
* No exception - finish adding the method to the class, or
* 'undefine' the class, at least making it obvious that the class didn't load completely (or in the case of rails/activesupport, allow it to be reloaded on-demand later)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>