ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:116458] [Ruby master Bug#20216] Circular parameter reference not checked for assignment
@ 2024-01-26 18:25 kddnewton (Kevin Newton) via ruby-core
  2024-01-27  9:52 ` [ruby-core:116462] " nobu (Nobuyoshi Nakada) via ruby-core
  0 siblings, 1 reply; 2+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2024-01-26 18:25 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

Issue #20216 has been reported by kddnewton (Kevin Newton).

----------------------------------------
Bug #20216: Circular parameter reference not checked for assignment
https://bugs.ruby-lang.org/issues/20216

* Author: kddnewton (Kevin Newton)
* Status: Open
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I wanted to check if this was a bug or desired.

Usually when you reference a parameter within its own default value (optional positional or optional keyword) it raises a syntax error. This is unless you use it in an assignment, in which case it is not checked. Is this desired? Here's an example:

```ruby
def foo(bar = bar = 1); end
def foo(bar: bar = 1); end
```

I'm not sure what this code is supposed to be doing. I expected it to raise a syntax error.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:116462] [Ruby master Bug#20216] Circular parameter reference not checked for assignment
  2024-01-26 18:25 [ruby-core:116458] [Ruby master Bug#20216] Circular parameter reference not checked for assignment kddnewton (Kevin Newton) via ruby-core
@ 2024-01-27  9:52 ` nobu (Nobuyoshi Nakada) via ruby-core
  0 siblings, 0 replies; 2+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-01-27  9:52 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

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


They are not "reference"s, I think.

----------------------------------------
Bug #20216: Circular parameter reference not checked for assignment
https://bugs.ruby-lang.org/issues/20216#change-106483

* Author: kddnewton (Kevin Newton)
* Status: Open
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I wanted to check if this was a bug or desired.

Usually when you reference a parameter within its own default value (optional positional or optional keyword) it raises a syntax error. This is unless you use it in an assignment, in which case it is not checked. Is this desired? Here's an example:

```ruby
def foo(bar = bar = 1); end
def foo(bar: bar = 1); end
```

I'm not sure what this code is supposed to be doing. I expected it to raise a syntax error.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

end of thread, other threads:[~2024-01-27  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 18:25 [ruby-core:116458] [Ruby master Bug#20216] Circular parameter reference not checked for assignment kddnewton (Kevin Newton) via ruby-core
2024-01-27  9:52 ` [ruby-core:116462] " nobu (Nobuyoshi Nakada) via ruby-core

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 NNTP newsgroup(s).