Re: [racket-users] TR hash-ref type design decision?

2018-01-11 Thread 'John Clements' via Racket Users
> On Jan 11, 2018, at 9:52 AM, Sam Tobin-Hochstadt wrote: > > This is an intentional design choice, but I also think it's pretty > hard to avoid. In particular, consider immutable hash tables. In that > case, (HT A B) is a subtype of (HT A* B), if A <: A*. But then for > immutable hash tables,

Re: [racket-users] TR hash-ref type design decision?

2018-01-11 Thread Sam Tobin-Hochstadt
This is an intentional design choice, but I also think it's pretty hard to avoid. In particular, consider immutable hash tables. In that case, (HT A B) is a subtype of (HT A* B), if A <: A*. But then for immutable hash tables, your `checked-hash-ref` has the same issue that the original type for `h

[racket-users] TR hash-ref type design decision?

2018-01-11 Thread 'John Clements' via Racket Users
I was surprised and a wee bit dismayed this morning to see that this code, using hash-ref with the wrong key type, typechecks: #lang typed/racket (define my-hash : (HashTable String String) (make-immutable-hash '(("abc" . "def") ("ghi" . "jkl" (hash-ref my-hash 1234) So, I printe