Hi.
Having long admired Julia from afar, I've started messing with it today.
There's something I'd like to discuss about Tasks.
Consider this code:
function p()
produce(1)
produce(2)
end
t = Task(p)
for i in 1:10
assert(!isempty(t))
end
This fails in the third iteration, because isempty consumes the task's
outputs (which seems unusal for isempty(), IMO).
As a newbie, I expect isempty() to avoid modifying its argument, or at
least to avoid observable modifications. I don't think isempty() is very
useful when it consumes outputs - the caller probably has something to do
with those outputs, and would not like to discard them. So unless I'm
missing the intended usage, I suggest that isempty() either should not
exist for tasks, or (better) that there would be some 'look-ahead' buffer
in the task so that isempty can store the consumed element there, rather
than discard it. I realize that doing so might be a nontrivial modification.
Opinions?
Cheers