nddrylliog/rock — comment on commit 019798b25843bfedcc6fb7929d6e8e7cbf0c8946
File:  line 0
By fredreichbier:

I got ... something working. Just have a look at it. It contains a funny workaround for a double-dereference bug!
```ooc
import structs/HashBag

Pair: class {
k: K
v: V

init: func (=k, =v) {}
}

//operator => (k: K, v: V) -> Pair { Pair new(k, v) }

hashbag: func (args: ...) -> HashBag {
hb := HashBag new()
args each(|arg|
pair := arg as Pair
// uh well yeah.
U := pair K
W := pair V
// add type checks here
if(!U inheritsFrom?(String))
Exception new("Gimme a string!") throw()
key := pair k as String
// this segfaulted:
// val := pair v as W
// but this works. haha!
val := (pair v as Pointer)& as W
hb put(key, val)
)
hb
}

hb := hashbag(Pair new("Hello", "World!"), Pair new("leet", 1337))
hb get("Hello", String) println()
hb get("leet", SSizeT) toString() println()

// failte!
hashbag(Pair new(1, "sup"))
```