General

Profile

maedi (Maedi Prichard)

  • Login: maedi
  • Registered on: 03/25/2019
  • Last sign in: 10/27/2025

Issues

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

Activity

12/06/2022

05:18 AM Ruby Feature #18980: `it` as a default block parameter
I see that `$.` is already a <a href="https://docs.ruby-lang.org/en/2.4.0/globals_rdoc.html">pre-defined variable</a> which would make `$.method_name` difficult to parse. Then `_$` looks a little bit too close to the pre-defined variable... maedi (Maedi Prichard)

12/02/2022

10:43 PM Ruby Feature #18980: `it` as a default block parameter
Or `_$`:
```Ruby
[1, 2, 3].map { puts _$ }
```
```
[1, 2, 3].map { puts _$ }
```
Or even just `$` by itself:
```Ruby
[1, 2, 3].map { puts $ }
```
```
[1, 2, 3].map { puts $ }
```
In my opinion $ is underutilised in Ruby compared to o...
maedi (Maedi Prichard)

12/01/2022

06:41 AM Ruby Feature #18980: `it` as a default block parameter
How about `_@`? It's your friendly neighborhood local-instance variable. I'm half joking but it is a local variable that refers to instances.
It's nice and illegal:
```ruby
[1, 2, 3].each { puts _@ }
```
Looks better when it's n...
maedi (Maedi Prichard)

04/19/2019

10:28 AM Ruby Misc #15723: Reconsider numbered parameters
jeremyevans says:
> we should limit support to a single argument, and use @ to represent the argument.
> ...
Well said. Completely agree!
maedi (Maedi Prichard)

03/26/2019

12:20 PM Ruby Misc #15723: Reconsider numbered parameters
I believe a bare `@` should still be implemented as it reconciles the original need of the ticket of “hard to read code” and “a readable named variable to refer to the first argument“, as well as matz’s “not fully satisfied with the beau... maedi (Maedi Prichard)

03/25/2019

07:38 PM Ruby Misc #15723: Reconsider numbered parameters
Great explanation, thanks :)
If it will be multiple params `@1`, `@2`, etc. Can we also have `@` aliasing `@1`? I think it's going to be a common use case to just have the one param.
maedi (Maedi Prichard)
06:59 PM Ruby Misc #15723: Reconsider numbered parameters
jeremyevans0, is it possible to have method/property calls that when without an object, reference the "current item" of the block they are in?
```ruby
posts.each { .author = 'Santa Clause' }
```
This stops the range situation (`..`)....
maedi (Maedi Prichard)
05:43 PM Ruby Misc #15723: Reconsider numbered parameters
Why not a single dot? (`.`) It mirrors the UNIX concept of "current directory":
```ruby
[1, 2, 3].each { puts . }
```
With a method/property:
```ruby
posts.each { ..author = 'Santa Clause' }
```
Keeps it simple. Makes it easier...
maedi (Maedi Prichard)
05:53 AM Ruby Misc #15723: Reconsider numbered parameters
I think the usefulness of this feature is when there's only one parameter. When there's multiple parameters it becomes more confusing to read `@1`, `@2`, `@3` and less confusing to just name the variables.
I think limiting the "magic ...
maedi (Maedi Prichard)

Also available in: Atom