[swift-evolution] Smart KeyPaths
BJ Homer
bjhomer at gmail.com
Fri Mar 31 08:21:47 CDT 2017
> Is it always in the form of $R<n>?
No. Prefixing a variable with a '$' allows you to create a long-lasting variable in lldb. By default, every 'expr' command runs in its own scope, which means identifiers defined in one command are not visible from another. Example:
(LLDB) expr let x = 1 + 2
$R0 = 3
(LLDB) print x + 3
Error: Undefined identifier 'x'
(LLDB) expr let $y = 3 + 4
$R1 = 7
(LLDB) print $y + 5
$R2 = 12
Typed on my phone, so the LLDB output is not exact, but you see the point: you can prefix an identifier with '$' to make it persist beyond the scope of that command. LLDB automatically creates numbered identifiers when running commands, but you can also create your own. And you could also have expressions like 'print $person.name', so looking for a '.' doesn't help.
-BJ
More information about the swift-evolution
mailing list