----- Original Message ----
From: "Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum" 10353@lyskom.lysator.liu.se To: pike-devel@lists.lysator.liu.se Sent: Thu, September 2, 2010 11:40:02 AM Subject: svalue problem
I'm not quite sure what you are trying to do, or why you are trying to do it this way, but if you need an svalue that can be modified later, you can use for example a mapping. Anyone who has a reference to the mapping will be able to see changes you make to it with the []= operator and things like m_delete().
Strings, on the other hand, are immutable, so you can not change the value of a string value you have already passed to someone.
Hmm, maybe that is the best thing. Someone may pass data into the callback that could be changed, so an indirect pointer, as in a mapping, probably is best.
So, when you change a string, it actually allocates a new one and assigns it to the variable, right? So the svalue (at the c level) actually changes? And the old string is freed?
Thanks