4 ms·
`defined?` is actually an operator: http://www.ruby-doc.org/docs/ProgrammingRuby/tut_expressions.html#definedandorandnot http://www.ruby-doc.org/docs/Programmin
by Slackwise 14y ago
`defined?` is actually an operator: http://www.ruby-doc.org/docs/ProgrammingRuby/tut_expressions.html#definedandorandnot http://www.ruby-doc.org/docs/ProgrammingRuby/tut_expressions...
That may make things actually more confusing on first glance, but it does give a technical reason why it doesn't follow method naming conventions.
- Xylakant 14y agodefined? behaves completely correct in respect to naming conventions. It's behavior is notable in a different way: It's one of the few places where undefined constants can appear in the code without raising an exception: jruby-1.6.8 :089 > defined? Foo::Bar => nil jruby-1.6.8 :090 > Foo::Bar NameError: uninitialized constant Foo::Bar