GithubHelp home page GithubHelp logo

pcostanza / contextl Goto Github PK

View Code? Open in Web Editor NEW
47.0 6.0 3.0 320 KB

ContextL is a CLOS extension for Context-oriented Programming (COP), and was the first language extension that explicitly supports COP when it was originally introduced in 2005.

License: MIT License

Common Lisp 100.00%

contextl's Introduction

ContextL

ContextL is a CLOS extension for Context-oriented Programming (COP), and was the first language extension that explicitly supports COP when it was originally introduced in 2005.

ContextL is also provided by Quicklisp.

Currently, there is no documentation available, but you can find some test cases in the distribution and an overview of ContextL's features in an overview paper. See also this general overview article about COP which also contains some ContextL examples.

ContextL depends on Closer to MOP, and is therefore only supported by the Common Lisp implementations that are supported by that library.

New in version 1.0.0:

  • New version number based on semantic versioning.
  • Since version 0.61, support for Allegro Common Lisp 8.2 & 9.0, ABCL, and LispWorks 6.1 has been added.
  • An option has been added to disable special slots, which may improve performance if they are not needed.
  • Thread safety has been improved.

New in version 0.61:

  • Added support for LispWorks 6.0.

Highlights of version 0.6:

  • Added support for first-class dynamic environments and DYNAMIC-WIND. Due to popular demand, these features can be used independently of the rest of ContextL, by way of using a separate system definition. (In that case, no CLOS MOP is used, so this should run in any ANSI-compliant Common Lisp implementation.)
  • Added support for Embeddable Common Lisp.
  • Resurrected support for Macintosh Common Lisp (now RMCL).
  • Improved extensibility of ContextL metaclasses.
  • Removed unnecessary redefinition warnings for layered classes in Allegro and LispWorks.
  • Removed dependencies on portable-threads and trivial-garbage.
  • Improved use of synchronization features for multithreaded CL implementations.
  • Switched to a uniform model for optional features.
  • Simplified and improved conditionalizations for Clozure Common Lisp and LispWorks, and removed mentions of OpenMCL (which was just the old name for Clozure Common Lisp).
  • Lots of small little bug fixes and improvements here and there.
  • Lots of special thanks to the following people who provided useful patches and comments: Willem Broekema, Theam Yong Chew, Alexander Gravilov, Attila Lendvai, and Tobias Rittweiler. Extra special thanks to Duane Rettig (of Franz Inc.) and Martin Simmons (of LispWorks Ld.) for helping with Allegro-specific and LispWorks-specific issues.

Highlights of version 0.51:

  • Ensure-layered-method now accepts function designators instead of just function names, due to Drew Crampsie.

Highlights of version 0.5:

  • ContextL is now thread-safe.
  • Added :in as an alternative for :in-layer in the various define-layered-xyz macros.
  • Added new functions active-layers and (setf current-layer-context).
  • Added a garbage collector for layer caches, such that redefinition of layers or certain methods in the ContextL MOP have an effect.
  • Simplified mapping of layer-related names to internal names, which should also make things easier to read when debugging ContextL programs.

Highlights of version 0.4:

  • The deflayer macro doesn't take a :layer-class option anymore, but instead a :metaclass option. This reflects that layers are in fact represented as CLOS classes.
  • Added the function current-layer-context. This captures the set of currently active layers, which can later be reinstalled with funcall-with-layer-context and apply-with-layer-context.
  • Added several readers for ContextL's metaclasses.

Highlights of version 0.31:

  • Added two versions of the figure editor example from the JMLC'06 paper to the test suite.

Highlights of version 0.3:

  • Added metacircular layer activation through ACTIVATE-LAYER-USING-CLASS and DEACTIVATE-LAYER-USING-CLASS.
  • Added WITH-SPECIAL-INITARGS and WITH-SPECIAL-INITARGS* macros for rebinding special slots based on their initargs.
  • WITH-ACTIVE-LAYERS and WITH-ACTIVE-LAYERS* now process initargs for layer-specific special slots such that they can be rebound at the same time when the respective layer is activated.
  • Added CALL-NEXT-LAYERED-METHOD for more convenient super calls in layered methods.
  • Added singleton classes. Layers are singletons and internally represented as singleton classes, but the notion of a singleton class is useful in itself, so ContextL provides this as a separate feature.

This project was partially funded by the Institute for the Promotion of Innovation through Science and Technology in Flanders (IWT-Vlanderen) from 2005-2008.

contextl's People

Contributors

pcostanza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

contextl's Issues

Setting *print-case* to :downcase affects names of layered function definers

I one of our systems, we had a (setf *print-case* :downcase) as a top-level form.
Using metacopy, the resulting layered copy method names are mixed case such as

metacopy-with-contextl::|=layered-function-definer-FOR-COPY-SELF=|

and subsequently lead to errors.

It would be desirable if the *print-case* chosen by the user wouldn't affect the
definer names.

Tests are failed on ECL and Clisp

I'm using ECL 21.2.1 and unit tests are failed with error:

:info:test ;;; Loading #P"/opt/local/lib/ecl-21.2.1/asdf.fas"
:info:test An error occurred during initialization:
:info:test The function CLOSER-MOP::MAYBE-REMOVE-INITIAL-METHODS is undefined..

When I've tried Clisp it fails as:

:info:test #P"/opt/local/lib/clisp-2.49.93+/dynmod/asdf.lisp"
:info:test (*DEFAULT-PATHNAME-DEFAULTS*
:info:test  #P"/opt/local/var/macports/build/_Users_catap_src_macports-ports_lisp_cl-contextl/cl-contextl/work/build/system/"
:info:test  #P"/opt/local/share/common-lisp/system/")
:info:test *** - READ from
:info:test        #<INPUT BUFFERED FILE-STREAM CHARACTER
:info:test          #P"/opt/local/var/macports/build/_Users_catap_src_macports-ports_lisp_cl-contextl/cl-contextl/work/.home/.cache/common-lisp/clisp-2.49.93+-unix-x86_64/opt/local/var/macports/build/_Users_catap_src_macports-ports_lisp_cl-contextl/cl-contextl/work/build/source/cl-contextl/cx-threads.fas"
:info:test          @229>
:info:test       : there is no package with name "CLOSER-MOP"

And SBCL works well

How to determine whether ContextL works correctlY?

I've read in the README in this project, that ContextL does not work on ECL, so I've ran tests on the newest release:

~/quicklisp/dists/quicklisp/software/contextl-20211230-git/test $ sh ecl-runall 
;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/contextl-packages.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/contextl-packages.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-threads.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-threads.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-util.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-util.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-dynamic-environments.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-dynamic-environments.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-dynamic-variables.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-dynamic-variables.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-dynascope.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-dynascope.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-special-class.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-special-class.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-singleton-class.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-singleton-class.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-function-macros.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-function-macros.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layer-metaclasses.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layer-metaclasses.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-gc.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-gc.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layer.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layer.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-partial-class.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Style warning:
;;;   in file cx-partial-class.lisp, position 821
;;;   at (DEFMETHOD INITIALIZE-INSTANCE ...)
;;;   ! The variable NAME is not used.
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-partial-class.lisp.
;;;
;;; Warning: Lisp compilation had style-warnings while
             compiling #<cl-source-file "contextl" "cx-partial-class">
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-class-in-layer.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-class-in-layer.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-function.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-function.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-access-class.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-access-class.lisp.
;;;
;;;
;;; Compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-class.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling /home/jack/quicklisp/dists/quicklisp/software/contextl-20211230-git/cx-layered-class.lisp.
;;;

(PERSON :NAME PASCAL) 
(EMPLOYER :NAME VUB) 
(PERSON :NAME PASCAL) 
(PERSON :NAME PASCAL) 
(EMPLOYER :NAME VUB) 
(:EMPLOYER (EMPLOYER :NAME VUB)) 
(PERSON :NAME ROBERT) 
(PERSON :NAME ROBERT) 
(EMPLOYER :NAME DOCOMO) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO)) 
(PERSON :NAME ROBERT) 
(:CITY ILMENAU) 
(EMPLOYER :NAME DOCOMO) 
(:CITY MUNICH) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO :CITY MUNICH)) 
(PERSON :NAME ROBERT :CITY ILMENAU :EMPLOYER
 (EMPLOYER :NAME DOCOMO :CITY MUNICH)) 
(PERSON :NAME ROBERT) 
(:CITY ILMENAU) 
(EMPLOYER :NAME DOCOMO) 
(:CITY MUNICH) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO :CITY MUNICH)) 
(PERSON :NAME ROBERT) 
(EMPLOYER :NAME DOCOMO) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO)) 
(PERSON :NAME ROBERT) 
(EMPLOYER :NAME DOCOMO) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO)) 
(PERSON :NAME ROBERT) 
(:CITY ILMENAU) 
(EMPLOYER :NAME DOCOMO) 
(:CITY MUNICH) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO :CITY MUNICH)) 
(PERSON :NAME ROBERT) 
(:CITY ILMENAU) 
(EMPLOYER :NAME DOCOMO) 
(:CITY MUNICH) 
(:EMPLOYER (EMPLOYER :NAME DOCOMO :CITY MUNICH)) 
(NAME (ROBERT :SLOT-ACCESS SUCCESSFUL) EMPLOYER (NAME DOCOMO CITY MUNICH)) 
:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"
;;;
;;; Compiling figure-editor.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Warning: No generic function present when encountering a defmethod for (SETF =LAYERED-FUNCTION-DEFINER-FOR-POINT-X=). Assuming it will be an instance of standard-generic-function.
;;; Warning: No generic function present when encountering a defmethod for (SETF =LAYERED-FUNCTION-DEFINER-FOR-POINT-Y=). Assuming it will be an instance of standard-generic-function.
;;; Warning: No generic function present when encountering a defmethod for (SETF =LAYERED-FUNCTION-DEFINER-FOR-LINE-P1=). Assuming it will be an instance of standard-generic-function.
;;; Warning: No generic function present when encountering a defmethod for (SETF =LAYERED-FUNCTION-DEFINER-FOR-LINE-P2=). Assuming it will be an instance of standard-generic-function.
;;; Finished compiling figure-editor.lisp.
;;;
real time : 5.983 secs
run time  : 10.721 secs
gc count  : 435 times
consed    : 2179202000 bytes
real time : 6.426 secs
run time  : 11.661 secs
gc count  : 470 times
consed    : 2355244976 bytes
;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"
;;;
;;; Compiling figure-editor-2.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling figure-editor-2.lisp.
;;;
real time : 7.936 secs
run time  : 14.764 secs
gc count  : 600 times
consed    : 2998401744 bytes
real time : 8.389 secs
run time  : 15.738 secs
gc count  : 636 times
consed    : 3177645040 bytes
;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

1 
2 
3 
4 
5 
6 
7 
8 
:DONE 
1 
2 
3 
4 
5 
6 
7 
8 
:DONE ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

"error caught correctly" ;;; Loading #P"/home/jack/quicklisp/setup.lisp"
;;; Loading #P"/home/jack/Warsztat/cl-builds/ecl-23.9.9/lib64/ecl-23.9.9/asdf.fas"

:DONE

I'm not sure what to make of it -- does it mean that all works correctly now, or there are some signs that it does not work, or these tests are not the good measure of whether the implementation works?

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.