ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:91088] [Ruby trunk Bug#15535] Optional arguments for definition - SyntaxError is not the correct Error type
       [not found] <redmine.issue-15535.20190114195203@ruby-lang.org>
@ 2019-01-14 19:52 ` waheed.barghouthi
  2019-01-14 23:34 ` [ruby-core:91091] [Ruby trunk Bug#15535] Optional arguments for definition - Syntax Error " nobu
  1 sibling, 0 replies; 2+ messages in thread
From: waheed.barghouthi @ 2019-01-14 19:52 UTC (permalink / raw)
  To: ruby-core

Issue #15535 has been reported by waheedi (Waheed Barghouthi).

----------------------------------------
Bug #15535: Optional arguments for definition - Syntax Error is not the correct Error type
https://bugs.ruby-lang.org/issues/15535

* Author: waheedi (Waheed Barghouthi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.0p0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
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 is a Syntax Error, I think another Error should be triggered if that intended to be made by design to error!

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




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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:91091] [Ruby trunk Bug#15535] Optional arguments for definition - Syntax Error is not the correct Error type
       [not found] <redmine.issue-15535.20190114195203@ruby-lang.org>
  2019-01-14 19:52 ` [ruby-core:91088] [Ruby trunk Bug#15535] Optional arguments for definition - SyntaxError is not the correct Error type waheed.barghouthi
@ 2019-01-14 23:34 ` nobu
  1 sibling, 0 replies; 2+ messages in thread
From: nobu @ 2019-01-14 23:34 UTC (permalink / raw)
  To: ruby-core

Issue #15535 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected

Required arguments cannot be placed between optional arguments **syntactically**, so it must be a `SyntaxError`.
`ArgumentError` is a runtime error.


----------------------------------------
Bug #15535: Optional arguments for definition - Syntax Error is not the correct Error type
https://bugs.ruby-lang.org/issues/15535#change-76322

* Author: waheedi (Waheed Barghouthi)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.0p0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
The below definition throws a Syntax Error, while there is no syntax error and I'm not sure what is the intention behind the Syntax Error

``` ruby
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.

``` ruby
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 a Syntax Error, I think the ArgumentError is more related to it. 

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




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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-14 23:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15535.20190114195203@ruby-lang.org>
2019-01-14 19:52 ` [ruby-core:91088] [Ruby trunk Bug#15535] Optional arguments for definition - SyntaxError is not the correct Error type waheed.barghouthi
2019-01-14 23:34 ` [ruby-core:91091] [Ruby trunk Bug#15535] Optional arguments for definition - Syntax Error " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).