Image Based Development

The package IBCL exports the same symbols as COMMON-LISP, but for some of the functions of macros modified to track of the source of the definitions and to be able to edit them from the image, and to save them in files.

The package IBCL-USER is a virgin package using IBCL instead of CL.

One can work at the REPL, define variables with DEFCONSTANT, DEFVAR, DEFPARAMETER, macros with DEFMACRO, and functions with DEFUN, edit macro and function definitions with ED, and save the image with SAVE-IMAGE.

The function LIST-PACKAGES-WITH-SOURCES returns a list of packages where some of these variables or functions are defined. The function SOURCE returns the source form of the given variable or function. The function SAVE-SOURCES saves the definitions in a package, or all the definitions to a file or stream.

A recent complete implementation of IBCL can be found in the Informatimago Common Lisp Library at gitorious, specifically: com.informatimago.common-lisp.lisp.

You can load it in a Common Lisp implementation with quicklisp:

cl-user> (ql:quickload :com.informatimago.common-lisp.lisp.ibcl)
To load "com.informatimago.common-lisp.lisp.ibcl":
  Load 1 ASDF system:
    com.informatimago.common-lisp.lisp.ibcl
; Loading "com.informatimago.common-lisp.lisp.ibcl"
[package com.informatimago.common-lisp.lisp.image-based-common-lisp]
[package com.informatimago.common-lisp.lisp.image-based-common-lisp-user]
(:com.informatimago.common-lisp.lisp.ibcl)
cl-user> (in-package :ibcl-user)
#<Package "COM.INFORMATIMAGO.COMMON-LISP.LISP.IMAGE-BASED-COMMON-LISP-USER">
image-based-common-lisp-user> (defun f (x)
                                (if (zerop x)
                                  1
                                  (* x (f (1- x)))))

f
image-based-common-lisp-user> (source 'f :function)
(defun f (x) (if (zerop x) 1 (* x (f (1- x)))))
#<Package "COM.INFORMATIMAGO.COMMON-LISP.LISP.IMAGE-BASED-COMMON-LISP-USER">
image-based-common-lisp-user> (defvar f 42)
f
image-based-common-lisp-user> (source 'f :variable)
(defvar f 42)
#<Package "COM.INFORMATIMAGO.COMMON-LISP.LISP.IMAGE-BASED-COMMON-LISP-USER">
image-based-common-lisp-user> (defun (setf f) (newval) (setf f newval))
(setf f)
image-based-common-lisp-user> (source '(setf f) :function)
(defun (setf f) (newval) (setf f newval))
#<Package "COM.INFORMATIMAGO.COMMON-LISP.LISP.IMAGE-BASED-COMMON-LISP-USER">
image-based-common-lisp-user> (in-package :cl-user)
#<Package "COM.INFORMATIMAGO.COMMON-LISP.LISP.IMAGE-BASED-COMMON-LISP-USER">
image-based-common-lisp-user> (cl:in-package :cl-user)
#<Package "COMMON-LISP-USER">
cl-user>
  

Old proof-of-concept source:


| Mirror on informatimago.com | Mirror on free.fr |
Valid HTML 4.01!