wait(::Task) deprecated in 0.7?


#1

I found this on the build log for StringEncodings.jl.

┌ Warning: `wait(t::Task)` is deprecated, use `fetch(t)` instead.
│   caller = wait(::OutputCollector) at OutputCollector.jl:158
└ @ BinaryProvider OutputCollector.jl:158

But, I thought fetch is supposed to return results and wait does not… They are not the same thing.

I then checked the online help and it seems to indicate proper usage of wait(t::Task):

  wait([x])

  Block the current task until some event occurs, depending on the type of the argument:

    •    Channel: Wait for a value to be appended to the channel.

    •    Condition: Wait for notify on a condition.

    •    Process: Wait for a process or process chain to exit. The exitcode field of a process can be used to determine success
        or failure.

    •    Task: Wait for a Task to finish. If the task fails with an exception, the exception is propagated (re-thrown in the
        task that called wait).

    •    RawFD: Wait for changes on a file descriptor (see the FileWatching package).

  If no argument is passed, the task blocks for an undefined period. A task can only be restarted by an explicit call to schedule
  or yieldto.

  Often wait is called within a while loop to ensure a waited-for condition is met before proceeding.

I tried to get more info from NEWS.md but it doesn’t quite tell me exactly what’s the change:

wait and fetch on Task now resemble the interface of Future.

#2

Right. The confusion was that Task wasn’t consistent with your expectation. We will keep ‘wait’, it just won’t return a value anymore. It sounds like you can just ignore the deprecation warning.


#3

Argh… that makes perfect sense. The deprecation detector isn’t smart enough to see the difference between wait(t) and x = wait(t), where only the latter case should be considered deprecated usage. So I guess the most sensible approach would be to just wait it out until Julia 1.0.