RubyBugs (A Nonymous)
- Login: RubyBugs
- Email: msiegel@riverdaletechinc.com
- Registered on: 04/30/2010
- Last sign in: 11/29/2025
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 2 | 5 | 7 |
Activity
06/10/2024
-
05:05 PM Ruby Feature #19001: Data: Add #to_h symmetric to constructor with keyword args [Follow-on to #16122 Data: simple immutable value object]
- Agreed, this need ended up being met by the initial implementation! Thank you, closing this ticket.
zverok (Victor Shepelev) wrote in #note-2:
> There isn't any need for this ticket as a separate request, as far as I am concerned.
>...
12/07/2022
-
08:44 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- Hi @mame! Thank you for your questions.
mame (Yusuke Endoh) wrote in #note-24:
> Thanks for the update.
> ...
The challenge is that this operation "make a copy of an immutable value object with 0 or more fields changed" is so fundamenta...
12/03/2022
-
04:29 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
> …treats unknown keywords passed to this method as an error. I had already made it clear that I thought it should be an error at the end of my message earlier in this thread … and I think we are all in agreement on this point in this ...-
02:09 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- ufuk (Ufuk Kayserilioglu) wrote in #note-28:
> Thank you @matz. I will update the implementation to make the no-args case an error, and point people to use `dup` to make identical shallow clones instead in the error message.
> ...
Hi Mat...
11/30/2022
-
07:58 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- For comparison, you can plug in the following example code for a faster implementation of `#with` and it should work the same:
```ruby
Point = Data.define(:x, :y) do
# Example only, too slow. Real implementation should eliminate alloc... -
07:52 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- mame (Yusuke Endoh) wrote in #note-17:
> @RubyBugs Please check my comment https://bugs.ruby-lang.org/issues/19000#note-13 . A wrong motivation example raises the suspicion that this API is actually confusing to users.
Quite right @mame...
11/28/2022
-
07:15 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- bdewater (Bart de Water) wrote in #note-15:
> I like `dup` as the method name 👍
> ...
Is there a way we could get more active Rubyists to weigh in? My sense is that there is a real tension in that:
* Nearly every major value objects g...
10/26/2022
-
06:16 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- > it should be an error to supply a keyword argument that the Data class does not have as members
+1 Agree!
**Please note, performance work should be planned** to ensure that such checking of the keyword args is as fast as possible...
10/21/2022
-
05:22 PM Ruby Feature #19000: Data: Add "Copy with changes method" [Follow-on to #16122 Data: simple immutable value object]
- Example from [value_semantics](https://github.com/tomdalling/value_semantics) gem which uses `with` as well:
```ruby
Point = ValueSemantics::Struct.new do
x Numeric
y Numeric
end
# An immutable instance
Origin = Point.new(x:...
09/08/2022
-
07:50 PM Ruby Feature #16122: Data: simple immutable value object
- I've filed a 2nd follow-up ticket [here](https://bugs.ruby-lang.org/issues/19001) for the Symmetric `#to_h` method whose values can be fed to a keyword-args constructor