Swift REPL runs in the context of the lldb debugger and, by default, prints the values of the variables declared in the expression. This is controlled by the lldb variable.
print-decls - If true, LLDB will print the values of
variables declared in an expression.
Currently only supported in the REPL
(default: true).
( :set list Swift REPL, lldb-.)
,
false. ( ,
lldb):
$ swift
Welcome to Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.39.1). Type :help for assistance.
1> struct SomethingComplex { let x = 1; let y = 2 }
2> let a = SomethingComplex()
a: SomethingComplex = {
x = 1
y = 2
}
3> :set set print-decls false
3> let b = SomethingComplex()
4>