[chuck-users] escaped backslash in string [BUG]

Kassen signal.automatique at gmail.com
Sat Mar 9 06:24:47 EST 2013


On Fri, Mar 08, 2013 at 03:56:14PM -0500, Joel Matthys wrote:
>    OK, I solved it. This fails:
> 
>    "\\hello" => xmit.addString;
> 
>    but this works:
> 
>    "\\hello" => string foo;
>    foo => xmit.addString;
> 
>    I guess the addString method doesn't have fully recognize escape
>    characters?

Does not look like a addString issue to me as the two statements
*should* be equivalent aside from the first string being anonymous.
addString should not be aware of the difference, depending on the rest
of the code the difference is only relevant to us and the garbage
collector.

I have a gut feeling this would fix it;

"\\hello" @ new string => mit.addString;

Something is going wrong initiating strings again; '"Hello"' -while
anonymous- should be a string as much as '2' is a integer. Based on
your example I'd say that escape characters get parsed when they enter
the namespace instead of when a string gets created as would be
proper.

Strictly speaking that doesn't mean my gut-feeling solution should fix
it as there the string stays anonymous too but often some extra
assignment works.

I think :-)
Kas.


More information about the chuck-users mailing list