Jump to content

Category:Sparkling: Difference between revisions

Line 76:
== The standard library ==
 
Similarly to almost all modern languages, the Sparkling distribution comes with a bunch of utility and run-time support functions bundled in various "packages" of the Sparkling standard library. These packages can be loaded separately by the host program (i. e. the native environment that runs the Sparkling interpreter); in the default mode, however, all standard functions are loaded at the beginning of a Sparkling session (represented by an "<tt>SpnContext"</tt> object, from an API point of view). Library functions are not special in the sense that they are just normal native extension functions. There is one exception, though: standard library functions assume the use of the context API, and as such, they require their user info argument to point to a valid <tt>SpnContext</tt> object. This is done so that these functions can use the error reporting facilities of the virtual machine.
 
The currently available standard packages are:
 
* I/O routines (writing/reading to/from standard streams and files)
* String manipulation: searching for and creating substrings, creating formatted strings, etc.
* Array and associative array manipulation, including sorting, searching and functional-style list processing, such as <tt>map()</tt> and <tt>reduce()</tt>
* Floating-point, integral and complex mathematical functions
* Shell and environment access (including system date and time), and access to the Sparkling API itself (e. g. compiling to bytecode, stack traces, etc.)
 
== Implementation ==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.