General

Profile

josh.cheek (Josh Cheek)

  • Login: josh.cheek
  • Email: [email protected]
  • Registered on: 06/10/2011
  • Last sign in: 11/10/2022

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 22 22

Activity

07/04/2021

10:56 AM Ruby Bug #18011: `Method#parameters` is incorrect for forwarded arguments
Y'all understand this way more than I do, can you comment on whether my analysis [here](https://github.com/rails/rails/issues/42653) seems correct? josh.cheek (Josh Cheek)
08:48 AM Ruby Bug #18011: `Method#parameters` is incorrect for forwarded arguments
jeremyevans0 (Jeremy Evans) wrote in #note-4:
> Note that from a caller's perspective, `[[:rest, :*]]` and `[[:rest, :*], [:keyrest, :**]]` have identical behavior. Both accept an arbitrary number of positional argument and arbitrary ke...
josh.cheek (Josh Cheek)
07:10 AM Ruby Bug #18021 (Closed): Mixins in Refinements: possibly multiple bugs, workarounds are awkward
## Maybe bug 1
Refinements must be created after methods are defined.
```ruby
# This one seems buggy
module M1
refine(Object) { include M1 }
def m() = M1
using M1
m rescue $! # => #<NameError: undefined local variable...
josh.cheek (Josh Cheek)

06/29/2021

06:09 AM Ruby Bug #18011: `Method#parameters` is incorrect for forwarded arguments
jeremyevans0 (Jeremy Evans) wrote in #note-1:
> Forwarded arguments is implemented as `(*args, &block)` with `ruby2_keywords`, not as `(*args, **kwargs, &block)`. If you add `def wrapper4(*r, &b) = wrapped(*r, &b),` to `methods` and the...
josh.cheek (Josh Cheek)
01:02 AM Ruby Bug #18011 (Closed): `Method#parameters` is incorrect for forwarded arguments
When asking a method about its parameters, forwarded arguments say they are a rest and a block (`wrapper1` in the example below).
However, when we use that signature, it raises an ArgumentError (`wrapper2` in the example below).
When I...
josh.cheek (Josh Cheek)

02/21/2021

05:34 PM Ruby Bug #17649: `defined?` invokes method once for each syntactic element around it
The reason seems to be because the generated iseq doesn't cache the intermediate calculations:
```sh
$ ruby -e 'puts RubyVM::InstructionSequence.new("defined? a.b.c.d.e.f").disasm'
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,...
josh.cheek (Josh Cheek)
04:13 PM Ruby Bug #17649: `defined?` invokes method once for each syntactic element around it
I should have clarified my expectation: On the ones that call `defined?` I expected the number of calls to be 1 less than the ones that don't call `defined?` josh.cheek (Josh Cheek)
03:51 AM Ruby Bug #17649 (Closed): `defined?` invokes method once for each syntactic element around it
Honestly, I was surprised `defined?` works with expressions at all. I wouldn't object to this feature being removed, it leads to strange situations where it invokes methods, like below, and silently returns wrong results, if any of the m... josh.cheek (Josh Cheek)
03:26 AM Ruby Bug #17619: if false foo=42; end creates a foo local variable set to nil
It's intentional. Eg what if you set the same variable in both branches? Then it would be clearer that you are expecting the variable to be visible outside the scope of the conditional.
Contrived code example:
```ruby
if eligible?...
josh.cheek (Josh Cheek)

04/03/2020

08:44 PM Ruby Bug #14413: `-n` and `-p` flags break when stdout is closed
For anyone curious, these are the examples I went with instead: https://twitter.com/josh_cheek/status/1246175226213404672 josh.cheek (Josh Cheek)

Also available in: Atom