General

Profile

Hanmac (Hans Mackowiak)

  • Login: Hanmac
  • Email: hanmac@gmx.de
  • Registered on: 05/14/2011
  • Last sign in: 02/21/2024

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 3 29 32

Activity

02/12/2026

05:00 PM Ruby Feature #21875: Handling of trailing commas in lambda parameters
there are functions that look for the amount of parameters that gets spooked by this:
```ruby
data = {
'a' => 1,
'b' => 2,
'c' => 3
}
data.each &proc {|a,| p a } #=> "a", "b", "c"
data.each &lambda {|a,| p a } #=>["a", 1], ["...
Hanmac (Hans Mackowiak)

03/14/2025

08:07 AM Ruby Bug #21142: Lazy enumerator `.each_with_index` ignores `.take(0)` before it
@nobu your opinion on this `take(0)` thing? Hanmac (Hans Mackowiak)

03/11/2025

02:45 PM Ruby Bug #21142: Lazy enumerator `.each_with_index` ignores `.take(0)` before it
You might want a different function.
`Enumerable#each_with_index` does reset the Enumerator, while `Enumerator#with_index` does not.
```ruby
p 3.times.lazy.take(0).each_with_index.to_a #[[0, 0], [1, 1], [2, 2]]
p 3.times.lazy.take(0).w...
Hanmac (Hans Mackowiak)

02/28/2025

01:00 PM Ruby Bug #21163: Inconsistencies in Kernel.Float compared to other number parsing methods
"0b10" and "0o10" are only handled by Integer
also Integer and to_i does have a base param
while Float and to_f have not
Hanmac (Hans Mackowiak)

02/26/2025

12:15 PM Ruby Feature #21157: Comparison operator <>
Isn't it easier to use sort_by instead? And then use an Array as Sorting Field?
```ruby
array.sort_by {|o| [o.y, -o.x] } #=> [#<struct Point x=5, y=2>, #<struct Point x=2, y=2>, #<struct Point x=1, y=2>, #<struct Point x=6, y=4>]
```
Hanmac (Hans Mackowiak)

02/24/2025

02:59 PM Ruby Feature #21155: File scoped namespace declarations as in C#
@artur86 the difference between these two are the module nesting
See this doku about this: https://ruby-doc.org/3.2/syntax/modules_and_classes_rdoc.html#label-Constants
In Short, the second variant can raise NameError if you don't ...
Hanmac (Hans Mackowiak)

01/15/2025

02:50 PM Ruby Bug #21040: String#next! method does not mutate $& variable
These are called `virtual variables`, a new object is created each time you try to access it
```c
rb_define_virtual_variable("$~", get_LAST_MATCH_INFO, match_setter);
rb_define_virtual_variable("$&", last_match_getter, 0);
...
Hanmac (Hans Mackowiak)

08/29/2024

02:10 PM Ruby Feature #20705: Should "0.E-9" be a valid float value?
we need to be careful with this, because while `0.1E-9` is also a valid ruby literal,
`0.E-9` is not. (unknown method E for 0)
`1E-9` is valid literal again
Hanmac (Hans Mackowiak)

08/26/2024

09:07 AM Ruby Feature #20692: Rewrite Array#bsearch in Ruby
`find_minimum_mode = finder || !finder` isn't this always true? Hanmac (Hans Mackowiak)

08/14/2024

12:50 PM Ruby Feature #20676: Pathnames aren't Comparable
nobu (Nobuyoshi Nakada) wrote in #note-2:
> Probably you may want to do:
> ...
Pathname class already has this kind of logic in the `<=>` function
it just doesn't include the `Comparable` module to add the other compare functions li...
Hanmac (Hans Mackowiak)

Also available in: Atom