Skip to content

Instantly share code, notes, and snippets.

@hinrik
Last active November 5, 2017 22:56
Show Gist options
  • Save hinrik/17f1075edc50cb6c7c315db819a5fa58 to your computer and use it in GitHub Desktop.
Save hinrik/17f1075edc50cb6c7c315db819a5fa58 to your computer and use it in GitHub Desktop.
abstract struct Foo
end
struct Bar < Foo
end
struct Baz < Foo
end
hash = {} of Foo => Int32
bar = Bar.new
baz = Baz.new
hash[bar] = 3
hash[baz] = 5
p hash
p hash[bar]
p hash[baz] # Missing hash key: Baz() (KeyError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment