Java Apps Wake Up
- By Kathleen Ohlson
New features were recently added to Sleep, an embeddable scripting language for Java applications. Developers use Sleep to design domain-specific languages for their applications.
Sleep 2.0 now features binary data support, closures and multidimensional data structures. It automatically casts Sleep arrays into native Java arrays and functions to cast Sleep arrays into multidimensional Java arrays. HOES now recognizes a short argument and builds a value for it. When errors occur, Sleep immediately jumps out of the current executing block.
Other recent additions include the ability to wait for a fork or callback read to finish; an extended syntax for iterating keys and values; and a fork function to create simple threads.
Sleep—developed by the Sleep Scripting Project—allows new functions, operators and constructs to be added to the language, fitting into new problem domains or embedding into Java applications. It extracts, parses, reworks and spits data back out, as well as extracting and sending it back to Java objects.
Inspired by Perl and Objective C programming languages, Sleep features serialization of parsed scripts, and APIs to create application data structures, and a unified I/O interface for sockets, processes and files. (Objective C is the objective-oriented version of the C programming language.) Similar to Perl, Sleep provides functionality to deal with binary data. An array of byte data is stored as a string, and each character strings to one byte.
Kathleen Ohlson is senior editor at Application Development Trends magazine.