Re: [racket-users] Typed Racket needs annotation to realize (Mutable-HashTable Symbol Symbol) is of a more general type

2019-11-06 Thread Alexis King
The point Sam is making is about the variance of Mutable-HashTable specifically. Its relationship to the HashTable supertype is a red herring (which is why changing the type to Mutable-HashTable didn’t help). Immutable data structures, like lists and immutable hash tables, are covariant in thei

Re: [racket-users] Typed Racket needs annotation to realize (Mutable-HashTable Symbol Symbol) is of a more general type

2019-11-06 Thread Ben Greenman
On 11/6/19, Marc Kaufmann wrote: > I assumed it was something to do with mutability, but I don't understand > what you mean when you say there is a two-way channel. The reference in > typed racket ( > https://docs.racket-lang.org/ts-reference/type-ref.html#%28form._%28%28lib._typed-racket%2Fbase-e

[racket-users] polymorphic datastructures in typed/racket

2019-11-06 Thread bedeke
Hello, I was trying to type some polymorphic classes but I got stuck early on making a polymorphic subclass #lang typed/racket/base ;*1* (require typed/racket/class) (define-type (C-class A)(Class [init-field [x A]])) (define C1% (class object% #:∀ (A) (init-field [x : A]) (super

Re: [racket-users] Typed Racket needs annotation to realize (Mutable-HashTable Symbol Symbol) is of a more general type

2019-11-06 Thread Marc Kaufmann
Thanks Alexis, I now see why the subtyping doesn't work and why mutability is the issue. So when using mutable data structures, I really have to use the largest possible type everywhere or add annotations or similar - making types on immutable data more flexible. That's interesting. Thanks for poi