If you find yourself regularly using the same
in different WMLScript code, you can put them into a library. Simply
put them all in the same file and declare them all
extern. They can then be accessed from all your
WMLScript code using a
url pragma and an external
function call, as described earlier in this chapter.
In addition to these user-defined libraries, WMLScript provides libraries that are built into the browser itself, not written in WMLScript. They can do tasks no program written purely in WMLScript can do. (Think of these as being a bit like system calls in a normal programming language.) These libraries are called standard libraries , to differentiate them from user-defined libraries written in WMLScript.
Because WMLScript is designed for simplicity, there are a number of
useful things it simply can’t do directly. For example,
although it can concatenate strings (using the
operator), there’s no way to then take substrings, extract
single characters from the string, or do any of the other common
operations that you might want to do to your strings, and that all
other programming languages allow you to do.
Similarly, there’s no consistent way to convert values between
the different datatypes. Yes, the values are converted automatically
if required, but the problems with the
mentioned in Chapter 11, show how it can sometimes
be important to force a value to a particular datatype.
All these functions and more are provided in WMLScript’s ...