ml.ruby-lang.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

ruby-core

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
ruby-core@ml.ruby-lang.org

June 2023

  • 2 participants
  • 201 discussions
[ruby-core:113778] [Ruby master Feature#12737] Module#defined_refinements
by shugo (Shugo Maeda) 06 Jun '23

06 Jun '23
Issue #12737 has been updated by shugo (Shugo Maeda). Eregon (Benoit Daloze) wrote in #note-15: > `Refinement#refined_class` is a bit strange given it can return a module. > How about adding `Refinement#refined_module` as an alias for clarity? I'm for it, but it may be better to create another issue. ---------------------------------------- Feature #12737: Module#defined_refinements https://bugs.ruby-lang.org/issues/12737#change-103427 * Author: shugo (Shugo Maeda) * Status: Closed * Priority: Normal * Assignee: shugo (Shugo Maeda) ---------------------------------------- How about to provide Module#defined_refinements, which returns the refinements defined in the receiver as a Hash, as follows: ``` module M refine String do $M_String = self end refine Integer do $M_Integer = self end end p M.defined_refinements #=> {String => $M_String, Integer => $M_Integer} ``` By `Module#defined_refinements`, you can activate refinements globally: ``` for klass, refinement in M.defined_refinements klass.prepend(refinement) end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:113777] [Ruby master Feature#12737] Module#defined_refinements
by Eregon (Benoit Daloze) 06 Jun '23

06 Jun '23
Issue #12737 has been updated by Eregon (Benoit Daloze). `Refinement#refined_class` is a bit strange given it can return a module. How about adding `Refinement#refined_module` as an alias for clarity? ---------------------------------------- Feature #12737: Module#defined_refinements https://bugs.ruby-lang.org/issues/12737#change-103426 * Author: shugo (Shugo Maeda) * Status: Closed * Priority: Normal * Assignee: shugo (Shugo Maeda) ---------------------------------------- How about to provide Module#defined_refinements, which returns the refinements defined in the receiver as a Hash, as follows: ``` module M refine String do $M_String = self end refine Integer do $M_Integer = self end end p M.defined_refinements #=> {String => $M_String, Integer => $M_Integer} ``` By `Module#defined_refinements`, you can activate refinements globally: ``` for klass, refinement in M.defined_refinements klass.prepend(refinement) end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:113773] [Ruby master Bug#19713] Off-by-one error when computing very large Integer numbers
by bannable (Joe Truba) 05 Jun '23

05 Jun '23
Issue #19713 has been reported by bannable (Joe Truba). ---------------------------------------- Bug #19713: Off-by-one error when computing very large Integer numbers https://bugs.ruby-lang.org/issues/19713 * Author: bannable (Joe Truba) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Ruby computes this Elliptic Curve result incorrectly when using Integer operations, but has the correct result when using Rational: ``` a = 154476802108746166441951315019919837485664325669565431700026634898253202035277999 b = 36875131794129999827197811565225474825492979968971970996283137471637224634055579 c = 4373612677928697257861252602371390152816537558161613618621437993378423467772036 int = a / (b + c) + b / (a + c) + c / (a + b) a = a.to_r rational = a / (b + c) + b / (a + c) + c / (a + b) puts [RUBY_VERSION, int == 4, rational == 4].join(' ') ``` Unfortunately, I'm not sure how to minimize this to something simpler than an EC computation. ## Actual ``` ➜ ~ asdf local ruby latest && ruby foo.rb 3.2.1 false true ➜ ~ asdf local ruby 3.1.3 && ruby foo.rb 3.1.3 false true ➜ ~ ``` ## Expected ``` ➜ ~ asdf local ruby latest && ruby foo.rb 3.2.1 true true ➜ ~ asdf local ruby 3.1.3 && ruby foo.rb 3.1.3 true true ➜ ~ ``` -- https://bugs.ruby-lang.org/
3 2
0 0
[ruby-core:113770] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers.
by ioquatix (Samuel Williams) 05 Jun '23

05 Jun '23
Issue #19056 has been updated by ioquatix (Samuel Williams). I understand your concerns. Every production system I've worked on has some kind of APM, and I've never heard anyone complain about the overhead - it's usually minuscule in comparison to the actual work being done. I'm fine for it to be a gem, but it will limit the application to core libraries. Careful application of such a feature can be incredibly helpful for debugging. One way to mitigate the performance is to use things like `prepend` to inject annotations to existing code. But it's clunky at best. ---------------------------------------- Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers. https://bugs.ruby-lang.org/issues/19056#change-103420 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- It's useful to know what a fiber is doing especially when they have a temporal execution (i.e. sockets connecting vs connected, binding vs accepting, queue popping, etc) Let's introduce `Fiber.annotate` and `Fiber#annotation` for logging a short message attached to Fibers. ```ruby Fiber.annotate "Counting to 10" 10.times{|I| puts I} # Fiber.current.annotation => "Counting to 10" ``` Pull Request: https://github.com/ruby/ruby/pull/6554 ---Files-------------------------------- clipboard-202210160132-n7lzp.png (865 KB) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:113769] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers.
by Eregon (Benoit Daloze) 05 Jun '23

05 Jun '23
Issue #19056 has been updated by Eregon (Benoit Daloze). Probably not, but I also think net-http shouldn't use it. There is overhead to e.g. call Addrinfo#inspect (or #to_s) in your screenshot above. Also for such logging to be useful one most likely needs string interpolation, which means string allocations even when the annotations are not used. And non-Fiber users probably have little to no use for those annotations. ---------------------------------------- Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers. https://bugs.ruby-lang.org/issues/19056#change-103419 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- It's useful to know what a fiber is doing especially when they have a temporal execution (i.e. sockets connecting vs connected, binding vs accepting, queue popping, etc) Let's introduce `Fiber.annotate` and `Fiber#annotation` for logging a short message attached to Fibers. ```ruby Fiber.annotate "Counting to 10" 10.times{|I| puts I} # Fiber.current.annotation => "Counting to 10" ``` Pull Request: https://github.com/ruby/ruby/pull/6554 ---Files-------------------------------- clipboard-202210160132-n7lzp.png (865 KB) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:113768] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers.
by ioquatix (Samuel Williams) 05 Jun '23

05 Jun '23
Issue #19056 has been updated by ioquatix (Samuel Williams). If it's not in core, can we still use it in `net-http` and other gems like that? ---------------------------------------- Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers. https://bugs.ruby-lang.org/issues/19056#change-103418 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- It's useful to know what a fiber is doing especially when they have a temporal execution (i.e. sockets connecting vs connected, binding vs accepting, queue popping, etc) Let's introduce `Fiber.annotate` and `Fiber#annotation` for logging a short message attached to Fibers. ```ruby Fiber.annotate "Counting to 10" 10.times{|I| puts I} # Fiber.current.annotation => "Counting to 10" ``` Pull Request: https://github.com/ruby/ruby/pull/6554 ---Files-------------------------------- clipboard-202210160132-n7lzp.png (865 KB) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:113767] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers.
by Eregon (Benoit Daloze) 05 Jun '23

05 Jun '23
Issue #19056 has been updated by Eregon (Benoit Daloze). Why not use a fiber-local variable for this? Then there is much less risk of conflict between libraries, and of course you can define convenience methods as you like. Or as you implemented it in that gem, as an attribute + `annotate(message) { ... }`. IMO this is good to be in a gem. I don't think it needs to be in core. ---------------------------------------- Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers. https://bugs.ruby-lang.org/issues/19056#change-103417 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- It's useful to know what a fiber is doing especially when they have a temporal execution (i.e. sockets connecting vs connected, binding vs accepting, queue popping, etc) Let's introduce `Fiber.annotate` and `Fiber#annotation` for logging a short message attached to Fibers. ```ruby Fiber.annotate "Counting to 10" 10.times{|I| puts I} # Fiber.current.annotation => "Counting to 10" ``` Pull Request: https://github.com/ruby/ruby/pull/6554 ---Files-------------------------------- clipboard-202210160132-n7lzp.png (865 KB) -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:113756] [Ruby master Bug#19711] NoMethodError "private method `new' called for class" since bebd05fb51ea65bc57344b67100748200f8311eb
by yahonda (Yasuo Honda) 04 Jun '23

04 Jun '23
Issue #19711 has been reported by yahonda (Yasuo Honda). ---------------------------------------- Bug #19711: NoMethodError "private method `new' called for class" since bebd05fb51ea65bc57344b67100748200f8311eb https://bugs.ruby-lang.org/issues/19711 * Author: yahonda (Yasuo Honda) * Status: Open * Priority: Normal * ruby -v: ruby 3.3.0dev (2023-06-03T00:35:18Z master bebd05fb51) [x86_64-linux] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Rails CI against ruby3.3.0dev has been failing https://buildkite.com/rails/rails/builds/96929#0188841c-cf1f-46d6-b48b-f510… According to git bisect, this change has been triggered via bebd05fb51ea65bc57344b67100748200f8311eb ### Steps to reproduce (that may not be minimum though) ``` $ gem install activesupport $irb require 'active_support/deprecation' klass = Class.new(ActiveSupport::Deprecation) deprecator = klass.new ``` ### Expected behavior It should successfully work as the previous commit does. ``` $ ruby -v ruby 3.3.0dev (2023-06-02T21:16:52Z master 4e26ae3cb9) [x86_64-linux] $ gem install activesupport Successfully installed activesupport-7.0.5 Parsing documentation for activesupport-7.0.5 Done installing documentation for activesupport after 1 seconds 1 gem installed $ irb irb(main):001:0> require 'active_support/deprecation' => true irb(main):002:0> klass = Class.new(ActiveSupport::Deprecation) => #<Class:0x00007f683e01a5b0> irb(main):003:0> deprecator = klass.new => #<#<Class:0x00007f683e01a5b0>:0x00007f683e2207b0 ... irb(main):004:0> ``` ### Actual behavior It gets "(irb):5:in `<main>': private method `new' called for class #<Class:0x00007fbd57dd9b10> (NoMethodError)" ``` $ ruby -v ruby 3.3.0dev (2023-06-03T00:35:18Z master bebd05fb51) [x86_64-linux] $ gem install activesupport Successfully installed activesupport-7.0.5 Parsing documentation for activesupport-7.0.5 Done installing documentation for activesupport after 1 seconds 1 gem installed $ irb irb(main):001:0> require 'active_support/deprecation' => true irb(main):002:0> klass = Class.new(ActiveSupport::Deprecation) irb(main):003:0> deprecator = klass.new (irb):3:in `<main>': private method `new' called for class #<Class:0x00007f7e13282bc8> (NoMethodError) from <internal:kernel>:187:in `loop' from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/irb-1.7.0/exe/irb:9:in `<top (required)>' from /home/yahonda/.rbenv/versions/trunk/bin/irb:25:in `load' from /home/yahonda/.rbenv/versions/trunk/bin/irb:25:in `<main>' irb(main):004:0> irb(main):003:0> require 'active_support/deprecation' => true irb(main):004:0> klass = Class.new(ActiveSupport::Deprecation) => #<Class:0x00007fbd57dd9b10> irb(main):005:0> deprecator = klass.new (irb):5:in `<main>': private method `new' called for class #<Class:0x00007fbd57dd9b10> (NoMethodError) from <internal:kernel>:187:in `loop' from /home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/irb-1.7.0/exe/irb:9:in `<top (required)>' from /home/yahonda/.rbenv/versions/trunk/bin/irb:25:in `load' from /home/yahonda/.rbenv/versions/trunk/bin/irb:25:in `<main>' irb(main):006:0> -- https://bugs.ruby-lang.org/
5 6
0 0
[ruby-core:113752] [Ruby master Bug#19710] Wrong answer output in "All together now" exercise at try.ruby-lang.org
by vividpixel (Nicholas Hawthorne) 04 Jun '23

04 Jun '23
Issue #19710 has been reported by vividpixel (Nicholas Hawthorne). ---------------------------------------- Bug #19710: Wrong answer output in "All together now" exercise at try.ruby-lang.org https://bugs.ruby-lang.org/issues/19710 * Author: vividpixel (Nicholas Hawthorne) * Status: Open * Priority: Normal * ruby -v: 3.2.0 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Couldn't find the error in my typed version of the code, so then I copied the provided solution and discovered it had the same output error: `0 Answer for the year 1591 should be 4` ---Files-------------------------------- try-ruby-exercise.png (1.94 MB) -- https://bugs.ruby-lang.org/
2 2
0 0
[ruby-core:113751] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers.
by ioquatix (Samuel Williams) 04 Jun '23

04 Jun '23
Issue #19056 has been updated by ioquatix (Samuel Williams). I came back to this issue. > I don't see the convenience of `Fiber.annotate`. Convince me. - Logging what the current fiber is doing. - Recording what the current fiber is doing when an error or exception occurs. - Real time debugger output (e.g. as shown in the screenshot). > Users need to understand how to use Fiber#annotation wisely. Need documents. Yes, I am happy to include documentation about it. > The state should be stacked, not overridden. How do you think? What about: ```ruby Fiber.annotate "x" do Fiber.annotation # "x" Fiber.annotate "y" do Fiber.annotation # "y" end Fiber.annotation # "x" end ``` > I have a bit of performance concern. Is it OK? It's a single pointer assignment so it should be minimal. Compared to "blocking operations" it should be irrelevant. In order to try this out more generally, I created a gem. You can see the proposed implementation here: https://github.com/ioquatix/fiber-annotate/blob/main/lib/fiber/annotate.rb The reason to make this a core interface, is so that default gems can use it. ---------------------------------------- Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers. https://bugs.ruby-lang.org/issues/19056#change-103398 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- It's useful to know what a fiber is doing especially when they have a temporal execution (i.e. sockets connecting vs connected, binding vs accepting, queue popping, etc) Let's introduce `Fiber.annotate` and `Fiber#annotation` for logging a short message attached to Fibers. ```ruby Fiber.annotate "Counting to 10" 10.times{|I| puts I} # Fiber.current.annotation => "Counting to 10" ``` Pull Request: https://github.com/ruby/ruby/pull/6554 ---Files-------------------------------- clipboard-202210160132-n7lzp.png (865 KB) -- https://bugs.ruby-lang.org/
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.