General

Profile

nhorton (Noah Horton)

  • Login: nhorton
  • Registered on: 07/16/2025
  • Last sign in: 08/28/2025

Issues

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

Activity

08/28/2025

02:34 PM Ruby Feature #21515: Add `&return` as sugar for `x=my_calculation; return x if x`
vo.x (Vit Ondruch) wrote in #note-1:
> Proposal like this always reminds me:
> ...
How does `my_var&.something` read? The safe navigator is not exactly simple english - you need to know what it does. Comedically, though, it does conjur...
nhorton (Noah Horton)
02:29 PM Ruby Feature #21515: Add `&return` as sugar for `x=my_calculation; return x if x`
nobu (Nobuyoshi Nakada) wrote in #note-3:
> Why not:
> ...
I have not seen it done this way. I will say that I started to say this did not work until I fully processed the `and` in this, so I am not sure on the legibility, but I think it...
nhorton (Noah Horton)
02:27 PM Ruby Feature #21515: Add `&return` as sugar for `x=my_calculation; return x if x`
Earlopain (Earlopain _) wrote in #note-2:
> I would prefer it like this:
> ...
I agree that this syntax would be solid if it worked.
nhorton (Noah Horton)

07/16/2025

02:56 PM Ruby Feature #21515 (Open): Add `&return` as sugar for `x=my_calculation; return x if x`
Let me preface this by saying I have no marriage to the exact keyword name of `&return`.
# Problem
It is very common to have an early return in code where you get some initial value and return it if it is non-null. i.e.
```
retur...
nhorton (Noah Horton)

Also available in: Atom