General

Profile

robb (Robb Shecter)

Issues

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

Activity

07/20/2021

08:47 AM Ruby Bug #12235: URI.encode issue with square brackets
I just ran into this. My app is generating URLs which it cannot then parse. robb (Robb Shecter)

02/17/2020

01:30 AM Ruby Feature #15563: #dig that throws an exception if a key doesn't exist
matz (Yukihiro Matsumoto) wrote in #note-4:
> And with whatever name, we need the real-world use-case for a new method.
Here is another real-world use-case, from my public.law apps which parse JSON:
```
def insert_subparts(for_i...
robb (Robb Shecter)
01:05 AM Ruby Feature #15563: #dig that throws an exception if a key doesn't exist
amcaplan (Ariel Caplan) wrote in #note-13:
> matz (Yukihiro Matsumoto) wrote:
> ...
I have a similar real-world use-case: I use chained `#fetch`s when importing JSON: My code needs the JSON to have the correct attributes and structure, a...
robb (Robb Shecter)
12:48 AM Ruby Feature #14602: Version of dig that raises error if a key is not present
amcaplan (Ariel Caplan) wrote:
> The Hash#dig method made it easy to access methods safely from a nested hash; I'd like to have something similar for access without error protection, and I'd think the most natural name would be Hash#dig...
robb (Robb Shecter)

12/28/2018

05:31 AM Ruby Feature #12282: Hash#dig! for repeated applications of Hash#fetch
Another naming idea is `#fetch_all`, signalling that this is essentially a `#fetch` over a list of keys. robb (Robb Shecter)
05:15 AM Ruby Feature #12282: Hash#dig! for repeated applications of Hash#fetch
Thanks everyone, for the discussion. I realize that my original comparison with #dig had a typographical error. Here's a gem implementation, with examples that are correct: https://github.com/dogweather/digbang
```
require 'dig_bang'...
robb (Robb Shecter)
05:27 AM Ruby Feature #15477 (Open): Proc#arity returns -1 for composed lambda Procs of known arguments
```
f = -> x { x + 2 }
g = -> x { x * 2 }
h = f << g
f.arity # => 1
g.arity # => 1
h.arity # => -1 THIS SHOULD BE 1 because h "knows" that it takes exactly 1 argument:
h.call # => ArgumentError (given 0, expected 1)
```
La...
robb (Robb Shecter)

04/14/2016

06:35 AM Ruby Feature #12282 (Open): Hash#dig! for repeated applications of Hash#fetch
A new feature for your consideration: #dig! which is to #fetch as #dig is to #[]. For me and maybe many others, Hash#fetch is used much more than Hash#[]. And traversing multiple fetches isn't very convenient nor Ruby-like, e.g.: places.... robb (Robb Shecter)

10/22/2015

09:12 AM Ruby Misc #11295: Request for comments about error messages
See also "Clarify the error message when calling a method with the wrong number of arguments", https://bugs.ruby-lang.org/issues/9025 robb (Robb Shecter)
09:11 AM Ruby Feature #9025: Clarify the error message when calling a method with the wrong number of arguments
"(expected: 1, provided: 0)" is excellent. This is a big usability issue. Python's message is similar, and includes the function name:
`TypeError: fun() takes exactly 1 argument (0 given)`
> I agree that someone not familiar with m...
robb (Robb Shecter)

Also available in: Atom