diff --git a/README.md b/README.md index d9699f9..b617366 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,14 @@ Stacktrace: @ REPL[3]:1 ``` +Note regarding the return type of `@spawn`: +* `Threads.@spawn` returns a value of the concrete type `Task` +* In contrast, the return type of `StableTasks.@spawn` may depend on any and all of the following: + * the configuration of type inference in the Julia compiler + * the return type of the input function + * in particular, assuming type inference is precise, `typeof(StableTasks.@spawn 3) != typeof(StableTasks.@spawn 3.0)`, because `typeof(3) !== typeof(3.0)` +* You should **not** write code that relies upon the exact return type of `StableTasks.@spawn` being concrete, or stable across versions. The return type in its parameter is available **only** as an optimization. + ## `StableTasks.@spawnat` The package also provides `StableTasks.@spawnat`, which is similar to `StableTasks.@spawn` but creates a *sticky* task (that won't migrate) on a specific thread. @@ -40,6 +48,8 @@ julia> @inferred fetch(t) 4 ``` +The note regarding the return type of `@spawn` also applies here. + ## `StableTasks.@fetch` and `StableTasks.@fetchfrom` For convenience, and in analogy to at Distributed.jl, we also provide `@fetch` and `@fetchfrom` macros: