while testing the documentation build i discovered that StringType was defined as string(width), however the actual implementation appears to require string(minwidth..maxwidth):
string(8) foo;
Compiler Error: 1:parse error, unexpected `')'', expecting `TOK_DOT_DOT' or `TOK_DOT_DOT_DOT' Compiler Error: 1:Expected integer range.
now i find references to string(width) in the documentation, which i guess should be changed, but to what? string(0..8) or string(0..255) or?
greetings, martin.
string(0..255)
The specialization of the string type is going to allow a code point range, much like how the int type with an integer range constrains ints carried in the variable to the given range (type checker wise, anyway).
great, thanks. what about string(0)?
there is one reference like that in src/operators.c line 4304: if(sp[-1].u.string->size_shift) { bad_arg_error("`~", sp-1, 1, 1, "string(0)", sp-1, "Expected 8-bit string.\n"); }
this seems rather odd...
greetings, martin.
I'd guess that's an incorrect representation of what Grubba reported, some time ago:
I've now changed the implementation of the subtype for strings in Pike 7.7 to an integer range rather than a width in bits:
typeof("");
(1) Result: string(zero)
typeof("foo");
(2) Result: string(0..255)
pike-devel@lists.lysator.liu.se