[ruby-core:104652] [Ruby master Feature#18040] Why should `foo(1 if true)` be an error?
From:
bughit.github@...
Date:
2021-07-20 08:27:34 UTC
List:
ruby-core #104652
Issue #18040 has been updated by bughit (bug hit). > implicit casting from a statement to an expression within a method definition body It's not just the method body, `x if y` without parens is an expression in any compound expression block which evaluates to its last expression value. That's a lot of contexts (loops, conditional, blocks, methods, lambdas, class bodies, module bodies, begin end, (x; y)) probably forgetting some. So what makes more sense, that it's conceptually an expression or a "statement" which oxymoronically produces a value? ---------------------------------------- Feature #18040: Why should `foo(1 if true)` be an error? https://bugs.ruby-lang.org/issues/18040#change-92961 * 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>