I see the behavior on OS X. It also occurs with three println's.
| | |_| | | | (_| | | Version 0.3.7-pre+1 (2015-02-17 22:12 UTC)
_/ |\__'_|_|_|\__'_| | Commit d15f183* (21 days old release-0.3)
|__/ | x86_64-apple-darwin13.4.0
julia> t = @async (println("foo");println("bar"); println("baz"))
foo
Task (queued) @0x00007fa0faf0e520bar
julia>
_
The _ indicates the cursor position after running the line of code. I hit
return only once after the first line starting with 't = @async...', and I
got two blank lines after Task was displayed, before the julia> prompt, and
the cursor ended up in the first column on a new line after the julia>
prompt.
On Tuesday, March 10, 2015 at 8:17:30 PM UTC-7, Amit Murthy wrote:
>
> Works fine on Linux.
>
>
>
> On Tue, Mar 10, 2015 at 11:28 PM, Ben Arthur <[email protected]
> <javascript:>> wrote:
>
>> in my continuing quest to understand Julia tasks, i have created the
>> following contrived example which does not behave as i would expect. can
>> anyone help explain please? thanks in advance.
>>
>> julia> function printfoobar()
>> println("foo")
>> println("bar")
>> end
>>
>> printfoobar (generic function with 1 method)
>>
>> julia> printfoobar() # great, it works
>> foo
>> bar
>>
>> julia> println("honey"); println("wagon") # no surprise again
>> honey
>> wagon
>>
>> julia> t = @async (println("honey"); println("wagon")) # works too,
>> modulo 'Task' being inbetween
>> honey
>> Task (queued) @0x00007fb59e832500wagon
>>
>> julia> t = @async printfoobar() # ditto: foo and bar both printed,
>> albeit with 'Task' inbetween
>> foo
>> Task (queued) @0x00007fb59f2e1720bar
>>
>> julia> t = @async (println("honey"); printfoobar(); println("wagon")) #
>> WHERE ARE bar AND wagon ???
>> honey
>> Task (queued) @0x00007fb59f2e1840foo
>>
>> julia> # <ENTER> #nope, they still don't appear
>>
>> julia> # <ENTER>
>>
>> julia> # <ENTER>
>>
>> julia> wait(t) # nope, still no further printed output
>>
>> julia> yield() # still no joy
>>
>> julia> istaskdone(t)
>> true
>>
>> is it that println("foo") and println("wagon") never get executed? or
>> that the output stream is just not making it to the REPL? this is in 0.3.6
>> by the way. similar things happen on a 0 day old master.
>>
>
>