Project

General

Profile

Bug #15535

Updated by waheedi (Waheed Barghouthi) about 5 years ago

The below definition throws a syntax Error, while it there is no syntax error and I'm not sure what is the intention behind the Syntax error 

 `def hello(foo="bar", bar, yanko="me")` 
 `p "Hello"` 
 `end` 

 The same definition below with a tiny modification in the argument set, give a Syntax OK. 

 `def hello(foo="bar", bar="foo", yanko="me")` 
 `p "Hello"` 
 `end` 

 It seems when there is a required argument in the definition that happens to be in between optional arguments that triggers is a Syntax Error, I think the ArgumentError is more related another Error should be triggered if that intended to it.  

 be made by design to error! 

 This has been tested on mostly every ruby version after 1.8.7 and it its gave the same result. 

Back