The language does not allow all variable declarations, though:
// OK
nonisolated(unsafe) let ns = ...
// Compiler error
if nonisolated(unsafe) let ns = ... { }
// Compiler error
guard nonisolated(unsafe) let ns = ... else { }
One can deal with if let
without coming up with a new variable name, though:
// OK
if let ns = ... {
nonisolated(unsafe) let ns = ns
}
But this won't work with guard
:
// Compiler error
guard let ns = ... else { }
nonisolated(unsafe) let ns = ns