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
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 (
>
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
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 (
The problem is that the `DB` type is _not_ a super-type of
`(Mutable-HashTable Symbol Symbol)`, because mutable data structures
are two way communications channels. If you used an immutable hash,
that's a one-way communication and you would have the expected result.
However, the change you made
Hi,
in order to put some discipline on my code (and formalize to myself what
I'm passing around), I started using typed racket. I have definitely hit my
share of gotchas that make me scratch my head, but I kind of start to
understand how things work and adding `(ann this-is ThatType)`
6 matches
Mail list logo