[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...

Issue #10333 has been updated by Koichi Sasada.

9 messages 2014/10/07

[ruby-core:65815] [ruby-trunk - Feature #10406] Method starting with a capital is not detected when parentheses and receiver are omitted

From: mame@...
Date: 2014-10-20 12:07:40 UTC
List: ruby-core #65815
Issue #10406 has been updated by Yusuke Endoh.


Oops, I see.  Sorry for the noise!

-- 
Yusuke Endoh <mame@ruby-lang.org>

----------------------------------------
Feature #10406: Method starting with a capital is not detected when parentheses and receiver are omitted
https://bugs.ruby-lang.org/issues/10406#change-49553

* Author: Tsuyoshi Sawada
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: syntax
* Target version: Next Major
----------------------------------------
A method whose name starts with a capital is not detected when parentheses and receiver are omitted.

~~~ruby
def Foo; puts "foo" end
Foo # => uninitialized constant Foo
~~~

If I disambiguate it as a method, then the method is detected:

~~~ruby
Foo() # => foo
~~~

This kind of consideration if unnecessary if the method name does not start with a capital.

~~~ruby
def foo; puts "foo" end
foo # => foo
~~~

So I expect method `Foo` to be detected without explicit receiver and arguments (unless there is a constant with the same name).

~~~ruby
def Foo; puts "foo" end
~~~

I first thought this as a bug. If it is not a bug, then I would like to ask this as a feature request.



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next