Issue #10778 has been updated by jeremyevans0 (Jeremy Evans).


There isn't a description of the actual problem caused by this behavior, but I'm guessing, it is something like this:

```
defined? a && defined? b # defined?(a && defined? b)
# => "expression"

defined? (a) && defined? (b) # defined?((a) && defined? (b))
# => "expression"

defined?(a) && defined?(b) # (defined?(a)) && (defined?(b))
# => nil
```

I'm reasonably confident changing the last example to be parsed as the first two examples would break existing code and would go against the expectations of most Ruby programmers.

----------------------------------------
Bug #10778: `defined?(expr)` should be equivalent to `defined? (expr)` not `(defined? expr)`
https://bugs.ruby-lang.org/issues/10778#change-80639

* Author: bughit (bug hit)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
defined? is an operator not a method, its operand is defined as the expressions to its right.

It does not even require a space: `defined?a`

So `defined?(a)` should be equivalent to `defined? (a)` instead of `(defined? a)`



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>