From 4b7b1fd21184447076118e3198a8168235b486a8 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Mon, 11 Apr 2022 05:56:35 -0400 Subject: [PATCH] Document the safety properties of lazy"str" --- base/strings/lazy.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/base/strings/lazy.jl b/base/strings/lazy.jl index 997fea95f7fb8..c153e471693da 100644 --- a/base/strings/lazy.jl +++ b/base/strings/lazy.jl @@ -47,6 +47,15 @@ LazyString !!! compat "Julia 1.8" `lazy"str"` requires Julia 1.8 or later. + +# Extended help +## Safety properties for concurrent programs + +A lazy string itself does not introduce any concurrency problems even if it is printed in +multiple Julia tasks. However, if `print` methods on a captured value can have a +concurrency issue when invoked without synchronizations, printing the lazy string may cause +an issue. Furthermore, the `print` methods on the captured values may be invoked multiple +times. """ macro lazy_str(text) parts = Any[]