TypeSystem

Overview

This topic discusses how the Common Lisp Types are implemented in CLforJava. In Common Lisp a data type is a set of Lisp objects. Many Lisp objects belong to more than one such set. In this way, it doesn't make sense to ask what is the "type" of an object, but whether an object belongs to a given type. The data types defined in Common Lisp are arranged into a hierarchial TypeSystem (actually a paratial order) defined by the subset relationship. The current picture includes the CLOS types. Also the CLOS types and the type extensions introduced in CLforJava are color coded. Those types that are implemented and tested are check-marked.

Common Lisp tangled type system.:

Click for Full Size Image of Lisp Type System

Current Proposal

In Java there is no way to support multiple inheritance for the Types we are to implement in a hierarchial structure. The current proposal is to create an interface for each Type that extends from its derived type. Inside of each type's interface a static final typeName is defined creating a new instance of that type using a Factory method. See DesignPatternUsage.

Here is an example of an interface for the Common Lisp type Atom:

public interface Atom extends T {

  public static final Symbol typeName = (Symbol)Package.CommonLisp.intern("ATOM").get(0);
 
}   

Adding Macro Functions

Implementation of the macro functions requires addition of 2 new types: MacroFunction and CompilerMacro.

References

HyperSpec CLtL
link 1 Link 2

Implementation

Here is an example of an interface for the Common Lisp type Atom:

public interface Atom extends T{

  public static final Symbol typeName = Symbol.Factory.newInstance("ATOM", "COMMON-LISP");
 
} 

Details of implementation

Core Java Classes Javadoc Links

Current Status of TypeSystem

Status: Green

Basic type system implemented in the Java interface structure. Basic pattern defined.

Release Level: Not Released

Open bug count: 0

Test Suites

Links to JUnit results

Spring 2003 Semester

The latest specification deliberations of Common Lisp have defined a new Lisp type: Boolean. This is a subtype of Symbol. It's only subtype is Null. The type Boolean has exactly 1 direct instance which is the symbol T. This must be implemented by the team during this semester. The definition of T should follow the definition of NIL as a singleton instance.

-- JerryBoetje - 10 Jul 2003

Topic revision: r21 - 2009-03-11 - 20:26:23 - MadelineWilliams
 
Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback