As of f3385a, precompile.pike seems to assume that strings are eight-bit by default. Consequently, the String.SingleReplace class (defined in builtin.cmod as single_string_replace and used automatically to optimize calls to "replace(variable, constant, constant)") chokes on wide strings:
$ pike Pike v8.1 release 2 running Hilfe v3.5 (Incremental Pike Frontend)
String.SingleReplace("\u1234","1");
Bad argument 1 to create(). Expected string|void. Unknown program: create("\u1234","1") -:1: _static_modules.Builtin()->single_string_replace()->create("\u1234","1") HilfeInput:1: HilfeInput()->___HilfeWrapper()
replace("Hello, world!","!","\u1234");
(1) Result: "Hello, world\u1234"
string x="Hello, world!"; replace(x,"!","\u1234");
Compiler Warning: 1: Optimizer failure in replace(). Compiler Warning: 1: Bad argument 2 to create(). Expected string|void. (2) Result: "Hello, world\u1234"
It does appear to be functional (presumably by falling back on the unoptimized version), but it looks as if this could have consequences elsewhere. Thoughts?
ChrisA
pike-devel@lists.lysator.liu.se