General

Profile

hmdne (hmdne -)

  • Login: hmdne
  • Registered on: 12/03/2021
  • Last sign in: 10/11/2024

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 0 1

Activity

05/20/2024

08:42 AM Ruby Feature #20498: Negated method calls
I saw such a proposal before and I thought of some syntax and implementation, but I didn't submit that in the previous issue:
```ruby
class MethodNegator < BasicObject
def initialize(obj)
@obj = obj
end
def method_mis...
hmdne (hmdne -)

01/02/2023

10:05 PM Ruby Feature #19300: Move public methods from Kernel to Object
In particular, Delegator works in an interesting way by:
1. Inheriting from BasicObject
2. Duping the Kernel module (as k)
3. Undefining some methods from k
4. Including k
So, for this particular purpose, moving methods from Ker...
hmdne (hmdne -)

12/30/2022

05:51 AM Ruby Bug #19286: What should kwargs' arity be?
kwargs are... complicated. Let me first extend the issue with additional versions of the above (I run Ruby 3.1, but from what I know, everything applies to anything >= Ruby 3.0):
```ruby
[1] pry(main)> method(def a(a:, b:); end).arity
=...
hmdne (hmdne -)

09/28/2022

01:30 PM Ruby Feature #19027: .= syntax
I like it, though one while reading that code could have a problem with attempting to find a `where` variable.
Perhaps a more clearer way to write this would be the following:
```
records.=where.not(id: excluded_ids) if some_condi...
hmdne (hmdne -)

08/17/2022

05:36 AM Ruby Feature #17330: Object#non
I had another idea regarding a #non method that I haven't voiced before, but may result in cleaner code overall:
```ruby
class Negator < ::BasicObject
def initialize(obj)
@object = obj
end
def method_missing(...)
...
hmdne (hmdne -)

02/27/2022

02:31 PM Ruby Feature #18603: Allow syntax like obj.method(arg)=value
@sawa - My proposal would be to allow omitting parentheses only if there are no arguments provided, ie. how it is currently.
```ruby
self.xyz = 6 # correct currently
self.xyz() = 6 # correct under the proposal
self.xyz(a) = 6 # cor...
hmdne (hmdne -)
03:14 AM Ruby Feature #18603 (Open): Allow syntax like obj.method(arg)=value
I propose here to allow a syntax like:
```ruby
obj.method(arg) = value
```
It would be translated to the following:
```ruby
obj.__send__(:method=, arg, value)
```
The lack of this syntax kind of limits the ability to desi...
hmdne (hmdne -)
03:24 AM Ruby Feature #18583: Pattern-matching: API for custom unpacking strategies?
> `# looking into global value isn't exactly elegant, right?`
It's not global, it's Fiber-local, so are $1 and friends. This may not be messaged well enough in the documentation though...
```ruby
[1] pry(main)> z = Fiber.new { /(....
hmdne (hmdne -)

01/16/2022

02:39 AM Ruby Feature #15559: Logical XOR (^^) operator
Hm, came into my mind that you may prefer to use this, more readable snippet instead:
```ruby
raise ArgumentError unless [bar, baz].one?
```
hmdne (hmdne -)
02:30 AM Ruby Feature #15559: Logical XOR (^^) operator
Since we don't need short-circuit evaluation, we can simply use `^` for that reason. It's already defined on both TrueClass and FalseClass AND NilClass.
@indirect your example can be written as follows:
```ruby
raise ArgumentE...
hmdne (hmdne -)

Also available in: Atom