Forum: Ruby-core Inconsistent SyntaxError in Ruby 2.1 mandatory keyword arguments definition without parentheses.

F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2014-03-25 05:52
(Received via mailing list)
Issue #9669 has been updated by Nobuyoshi Nakada.


Or put a semicolon after `b:`.

Matthew Kerwin wrote:
> I think Ruby should drop the line continuation, and interpret all three code
samples like the second case above, even though it might be hard to solve with 
the
current parser.

Do you mean *all* line continuations?

----------------------------------------
Bug #9669: Inconsistent SyntaxError in Ruby 2.1 mandatory keyword
arguments definition without parentheses.
https://bugs.ruby-lang.org/issues/9669#change-45922

* Author: Teja Sophista
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: 2.1.1
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Ruby allowed us to define method with arguments without parentheses.

~~~
def foo a:, b:
  'bar'
end
#=> :foo

def foo a:, b:
  puts 'bar'
end
#=> syntax error
~~~
This topic is locked and can not be replied to.