read(key :k, chan Chan[:a]) {
# Reads from the output channel until empty.
for item in chan {
out.put(Pair[:k,:a](key, item))
}
}
But this doesn't:
read(key :k, chan Chan[:a]) {
# Reads from the output channel until empty.
for item in chan {
if out.state == ChanState::CLOSED {
ret
}
out.put(Pair[:k,:a](key, item))
}
}
The error message is:
Chan.jg:36:28: Unbound generic type ':k'
Chan.jg:36:21: Argument does not conform to type 'Pair[:k,:a]' (:a)
It seems like the 1st statement in the loop is not typechecked.
The following code works:
But this doesn't:
The error message is:
It seems like the 1st statement in the loop is not typechecked.