> why not p = a ? Because Nim is statically typed. In your example a is a Nim string, and p a pointer to a Nim string. So data types are different. When you apply addr() to a string, you get a pointer to it. That is similar as it is in C++, where you have C++ strings and can have pointers or references to that string.
For current Nim you have to take into account that Nim strings are garbage collected, so their memory may be freed automatically. Personally I would avoid using low level operations like addr() for garbage collected Nim objects whenever possible. For example, it may be OK to pass the addr() of the first element in a seq or string to a C library function, when that function copy that data. But problems may occur, when that function uses that data while GC thinks that memory chunk is unused and frees it.
