ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:117781] [Ruby master Bug#20472] Ractor support for ** into hash literal
@ 2024-05-06 17:39 kddnewton (Kevin Newton) via ruby-core
  2024-09-10 13:49 ` [ruby-core:119113] " luke-gru (Luke Gruber) via ruby-core
  2024-09-30  5:01 ` [ruby-core:119344] " mame (Yusuke Endoh) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2024-05-06 17:39 UTC (permalink / raw)
  To: ruby-core; +Cc: kddnewton (Kevin Newton)

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

----------------------------------------
Bug #20472: Ractor support for ** into hash literal
https://bugs.ruby-lang.org/issues/20472

* Author: kddnewton (Kevin Newton)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
```ruby
# shareable_constant_value: experimental_copy
a = { "foo" => "bar" }
A = { **a }
```

In this example, Ruby fails an assertion and crashes. I think we should either provide support for this, or we should explicitly provide a syntax error indicating that ** isn't allowed in constant writes when ractor pragmas are enabled.



-- 
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] 3+ messages in thread

* [ruby-core:119113] [Ruby master Bug#20472] Ractor support for ** into hash literal
  2024-05-06 17:39 [ruby-core:117781] [Ruby master Bug#20472] Ractor support for ** into hash literal kddnewton (Kevin Newton) via ruby-core
@ 2024-09-10 13:49 ` luke-gru (Luke Gruber) via ruby-core
  2024-09-30  5:01 ` [ruby-core:119344] " mame (Yusuke Endoh) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-10 13:49 UTC (permalink / raw)
  To: ruby-core; +Cc: luke-gru (Luke Gruber)

Issue #20472 has been updated by luke-gru (Luke Gruber).


I've created a patch here: https://github.com/luke-gru/ruby/commit/5c3b7aacf23eaa9f6b1d2a2b5e2028d703dc190a

Let me know if this is a good fix or not, as it currently allows things like this:

```ruby
# shareable_constant_value: literal
b = Object.new
a = {"foo" => b}
C = {**a}
p C
p C.frozen? # => true
p C['foo'].frozen? # => true
p b.frozen? # => true
```
This behavior is probably not what's expected when shareable_constant_value is literal because ``**a` isn't a literal. However, other non-literals are also supported right now such as variable accesses. I could fix this issue but it would take a bit of work.

----------------------------------------
Bug #20472: Ractor support for ** into hash literal
https://bugs.ruby-lang.org/issues/20472#change-109706

* Author: kddnewton (Kevin Newton)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
```ruby
# shareable_constant_value: experimental_copy
a = { "foo" => "bar" }
A = { **a }
```

In this example, Ruby fails an assertion and crashes. I think we should either provide support for this, or we should explicitly provide a syntax error indicating that ** isn't allowed in constant writes when ractor pragmas are enabled.



-- 
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/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:119344] [Ruby master Bug#20472] Ractor support for ** into hash literal
  2024-05-06 17:39 [ruby-core:117781] [Ruby master Bug#20472] Ractor support for ** into hash literal kddnewton (Kevin Newton) via ruby-core
  2024-09-10 13:49 ` [ruby-core:119113] " luke-gru (Luke Gruber) via ruby-core
@ 2024-09-30  5:01 ` mame (Yusuke Endoh) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2024-09-30  5:01 UTC (permalink / raw)
  To: ruby-core; +Cc: mame (Yusuke Endoh)

Issue #20472 has been updated by mame (Yusuke Endoh).

Assignee set to ko1 (Koichi Sasada)

----------------------------------------
Bug #20472: Ractor support for ** into hash literal
https://bugs.ruby-lang.org/issues/20472#change-109955

* Author: kddnewton (Kevin Newton)
* Status: Open
* Assignee: ko1 (Koichi Sasada)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
```ruby
# shareable_constant_value: experimental_copy
a = { "foo" => "bar" }
A = { **a }
```

In this example, Ruby fails an assertion and crashes. I think we should either provide support for this, or we should explicitly provide a syntax error indicating that ** isn't allowed in constant writes when ractor pragmas are enabled.



-- 
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/lists/ruby-core.ml.ruby-lang.org/

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

end of thread, other threads:[~2024-09-30  5:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 17:39 [ruby-core:117781] [Ruby master Bug#20472] Ractor support for ** into hash literal kddnewton (Kevin Newton) via ruby-core
2024-09-10 13:49 ` [ruby-core:119113] " luke-gru (Luke Gruber) via ruby-core
2024-09-30  5:01 ` [ruby-core:119344] " mame (Yusuke Endoh) 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).