ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Sleep (programming language) - Wikipedia, the free encyclopedia

Sleep (programming language)

From Wikipedia, the free encyclopedia

Sleep (as of Simple Language for Environment Extension Purposes) is a procedural scripting language inspired by Perl and Objective-C. The only known implementation of the language is written in Java and is intended for embedding into existing Java applications to provide scripting services.

The Sleep Java API allows the language to be extended with new constructs, operators, functions, and variable containers, making it easy to integrate it into applications.

Sleep is currently utilized in the IRC client JIRCii and the IRC bot SleepyBot.

Contents

[edit] Overview

Sleep is very easy to learn in its basic form, and anyone familiar with Perl or PHP will feel right at home. In addition to being embeddable, Sleep can also be used stand-alone on the command line or using an interactive shell.

[edit] Language features

[edit] Data structures and types

Sleep has native support for three widely different data types: scalars, arrays, and hashes. Scalars are prefixed with a dollar sign ($), arrays with 'at'-signs (@) and hashes with percentage signs (%).

[edit] Scalars

Scalars represent either a string, or a number. Strings can be specified in run-time as literals or as parsed literals. Numbers are either integers, or floating point. Scalars can also contain references to objects when utilizing the HOES subsystem.

[edit] Arrays

Arrays are a collection of scalars, hashes or other arrays referenced by an index number, starting at 0.

[edit] Hashes

Hashes are similar to arrays, but maps keys to values. Keys can be both strings and numbers.

[edit] Dynamic typing

Sleep is a dynamically typed language. This means that variables don't have to be declared, or typed, before being used. There are certain advantages to this, and also certain disadvantages.

[edit] Input/output

Included in Sleep is support for basic input/output. This includes reading and writing from/to files and sockets.

[edit] Serialization

Parsed Sleep scripts can be serialized and saved to disk. This means faster execution of scripts since the script interpreter can skip the parser and scanner steps.

[edit] HOES

HOES is a feature that lets the scripter manipulate Java objects using a syntax similar to Objective-C. Objects and primitives can be referenced via ordinary Sleep scalars.

[edit] Easy integration

Sleep is integrated into Java applications using the concept of "programmatical bridges". These bridges act as a proxy between the Sleep scripts and the application they're run for. Bridges are written in Java, and there is extensive documentation and tutorials on how to write them.

Sleep supports the following bridge types:

  • Loadable bridges
  • Function bridges
  • Operator bridges
  • Predicates bridges
  • Evaluation bridges
  • Variable bridges
  • Environment bridges
  • Filtered environment bridges
  • Predicate environment bridges

Bridges can also act as "modules", as in expanding the API available to the scripts. For example, a JDBC module is underway, providing advanced database connectivity to Sleep scripters. Several other similar modules are also being planned to expand Sleep with XML/XSLT capabilities, improved sockets with support for UDP, Swing GUI, and more.

[edit] Applications

Sleep is currently being used actively in the following applications:

[edit] Code examples

[edit] "Hello world"

# This example outputs "Hello world!" to stdout
println("Hello World!");
# Usage: format(subject, repl1, repl2, ...,);
# Example: format('a {0} c', 'b');
#   returns 'a b c'
sub format 
{
    local('$subject @args $idx $match');
    @args = @_;
    $subject = removeAt(@args, 0);
    foreach $i => $arg (@args) {
        $match = '{' . $i . '}';
        $subject = strrep($subject, $match, $arg);
    }
    return $subject;
}

[edit] Arrays and hashes

[edit] Loops

[edit] I/O

[edit] HOES

[edit] Status and History

Sleep first version appeared in a week-end of coding in April 2002. Since then Sleep has been developed in parallel with a Java IRC Client which heavily uses its features called jIRCii. The current stable 2.0 version is available since July 2005. The new 2.1 development version is still in the Beta cycle phase.

[edit] External links


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -