Issue #18040 has been updated by sawa (Tsuyoshi Sawada).


It looks like the reason bughit is insisting is because of the description in the book that they cite. And indeed, if `1 if false` in the method definition given in note 3 is not an expression, then `2` is, and it could be taken that the citation implies that `2` (= "the last expression evaluated within the method body") would be the return value of the method invocation, contrary to fact. So it looks like the logical possibilities are:

* 1. There is implicit casting from a statement to an expression within a method definition body (which bughit denies in note 2 without grounds: "Parens don't turn it into an expression"), or
* 2. The book is not accurate (which is an issue because one of its authors is Matz, meaning that it is official).

----------------------------------------
Feature #18040: Why should `foo(1 if true)` be an error?
https://bugs.ruby-lang.org/issues/18040#change-92959

* Author: bughit (bug hit)
* Status: Open
* Priority: Normal
----------------------------------------
There's no ambiguity here that should require another set of parens `foo((1 if true))`



-- 
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>