-- or --
integer i = string(object x)
This serves to define the string type.
You can also call it like an ordinary function to determine if an object is a string.
When invoked as a function, returns 1 if x is a string otherwise returns 0.
A type check error occurs if a variable declared as a string is assigned to a dword-sequence.
string s s = "hello"
if string(x) then puts(1,x) else -- x must be an atom or dword-sequence ? x end if
|Implementation:||There are generic versions of the string function implemented as :%opStr in builtins\VM\pType.e and :%opStr0 in builtins\VM\pJcc.e that the compiler only invokes as a last resort, preferring instead to inline that functionality if the argument is known to be assigned or the result variable, if any, is known to be an integer, ie does not require decref/dealloc. The compiler may also completely omit the test and/or any related code, if type inference/propagation determines that the result will always be true or always false.|
|See Also:||atom, integer, sequence, object, Sequences, Core Language, Strings|