General

Profile

MaxLap (Maxime Lapointe)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 3 8 11

Activity

05/20/2024

01:41 PM Ruby Feature #20498: Negated method calls
For `foo&.!empty?`, the result would be `nil` if `foo` is `nil`. This is not handled by the prototype.
The alternatives mentionned so far look like this:
`foo&.empty?&.!`
`foo&.non&.empty?`
`foo&.empty?&.not`
`foo&.!(&:empty?)`
...
MaxLap (Maxime Lapointe)
01:02 PM Ruby Feature #20498: Negated method calls
Thanks for the feedback. I updated the gist to have an example with arguments in the call:
```ruby
puts A.new.!exists?(with_friends: true, skip_administrator: true)
```
This highlights some problems with the alternatives:
* Ca...
MaxLap (Maxime Lapointe)

05/19/2024

10:52 PM Ruby Feature #20498 (Open): Negated method calls
I want to propose the following syntax: `foo.!bar`. I know it's already valid syntax, but please read on for details.
When someone write a somewhat long line of code that is negated, the main way I've seen of doing it is:
```
must...
MaxLap (Maxime Lapointe)

02/29/2024

03:25 PM Ruby Bug #20312: Memory leak with BigDecimal::EXCEPTION_OVERFLOW
Oh right! Sorry, done: https://github.com/ruby/bigdecimal/issues/290 MaxLap (Maxime Lapointe)

02/28/2024

03:46 PM Ruby Bug #20312 (Third Party's Issue): Memory leak with BigDecimal::EXCEPTION_OVERFLOW
The following causes a memory leak.
I left a commented line, both trigger an memory leak. I assume it's the same bug
```
require 'bigdecimal'
BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true)
10.times do |j|
100000.ti...
MaxLap (Maxime Lapointe)
12:03 PM Ruby Bug #20311 (Closed): Struct.new("A") memory leak?
The following code gives the impression of a memory leak.
```ruby
10.times do
5000.times do
Struct.new("A")
Struct.send(:remove_const, :A)
end
GC.start
puts `ps -o rss= -p #{$$}`.to_i
end
```
```
27868
...
MaxLap (Maxime Lapointe)

02/26/2024

04:21 PM Ruby Feature #20300: Hash: set value and get pre-existing value in one call
In my mind, `get_and_set` is clear as it is in the order the operations are done.
But if you want clearer, `get_then_set` puts emphasis on the order.
Things like `exchange` and `swap` can sound like swapping the value between two k...
MaxLap (Maxime Lapointe)
03:39 PM Ruby Bug #20304: Memory leak when setting Encoding.default_internal
Ah, thank you! I would have expected that to be in 3.3-head too. MaxLap (Maxime Lapointe)
02:28 PM Ruby Bug #20304 (Closed): Memory leak when setting Encoding.default_internal
Problem is present in Ruby 3.2.2, 3.2.3, 3.3.0. Didn't check before.
Put this in a file:
```
10.times do
100000.times do
Encoding.default_internal = nil
end
puts `ps -o rss= -p #{$$}`.to_i
end
```
Result:
```...
MaxLap (Maxime Lapointe)
03:23 AM Ruby Bug #20299: Tracepoint staying enable after a disable
And here is a similar problem, using only the block form (no calls to disable):
```
def check_speed(msg = nil)
t1 = Time.now.to_f
a = 0
1000000.times { |i|
a += 10
}
t2 = Time.now.to_f
puts "#{t2-t1} - #{msg}"
...
MaxLap (Maxime Lapointe)

Also available in: Atom