GithubHelp home page GithubHelp logo

paren-psos's Introduction

The ParenScript Object System is a CLOS-like object system for ParenScript.  Using the system is  very similar to CLOS.  it includes a dynamic runtime environment (found in paren-src/*.paren).

The ParenScript Object System
Red Daly, Stanford Department of Computer Science
[email protected]

Introduction
The JavaScript language supports prototype-based inheritance.  Although adequate for most scripting tasks, JavaScript has become used more extensively in client-side applications to the point of replicating desk-top application functionality.  In large applications like these, developers often opt for a more extensive object system.  Google has developed a toolkit for compiling Java into JavaScript, and many options in native JavaScript already exist that implement class-based inheritance.

The ParenScript Object System (PSOS) is a facility for object-oriented programming in ParenScript, a lispy language that compiles to JavaScript.  PSOS as a whole was largely inspired by the Common Lisp Object System (CLOS).  Its features include, or will include, class-based inheritance, generic functions, and a meta-object protocol.  The utility of this system has already been demonstrated by [1], an implementation of a Web Ontology Language (OWL) reasoner that incorporates OWL classes into the ParenScript language.

Requirements
PSOS requires some extensions beyond the base features provided by parenscript a modified version of parenscript can be downloaded at https://github.com/3b/parenscript/

Example Usage
Using the ParenScript system for generating JavaScript, the syntax for defining a new class is simple:

    (defclass person ())
    (defclass politician (person))

After defining classes, we can define methods that operate on these classes.  The first step is defining a generic function, which is a type of function that acts differently depending on the classes of its arguments.  Next, methods that specialize the generic function can be defined.

    (defgeneric discuss-environment (individual))
    (defmethod discuss-environment ((individual person))
        (alert "I don't know anything about the environment"))
    (defmethod discuss-environment ((individual politician))
        (alert "The environment is an important issue, but so is Osama Bin Laden"))

paren-psos's People

Contributors

gonzojive avatar russell avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.