The cl-curlex Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-curlex Reference Manual

This is the cl-curlex Reference Manual, version 0.3, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 07:59:03 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

cl-curlex

Leak *LEXENV* variable which describes current lexical environment into body of a call. Update: do other exotic stuff, which requires access to the current lexical environment.

Basic example:

CL-USER> (ql:quickload 'cl-curlex)
CL-USER> (cl-curlex:with-current-lexenv *lexenv*)
#S(SB-KERNEL:LEXENV
:FUNS NIL
:VARS NIL
:BLOCKS NIL
:TAGS NIL
:TYPE-RESTRICTIONS NIL
:LAMBDA #<SB-C::CLAMBDA
        :%SOURCE-NAME SB-C::.ANONYMOUS.
        :%DEBUG-NAME (LAMBDA ())
        :KIND NIL
        :TYPE #<SB-KERNEL:FUN-TYPE (FUNCTION NIL (VALUES T &OPTIONAL))>
        :WHERE-FROM :DEFINED
        :VARS NIL {AE26BA9}>
:CLEANUP NIL
:HANDLED-CONDITIONS NIL
:DISABLED-PACKAGE-LOCKS NIL
:%POLICY ((COMPILATION-SPEED . 1) (DEBUG . 1) (INHIBIT-WARNINGS . 1)
          (SAFETY . 1) (SPACE . 1) (SPEED . 1))
:USER-DATA NIL)

Slightly more sophisticated:

CL-USER> (let ((a 1)) (cl-curlex:with-current-lexenv (let ((b 1)) *lexenv*)))
#S(SB-KERNEL:LEXENV
  :FUNS NIL
  :VARS ((A . #<SB-C::LAMBDA-VAR :%SOURCE-NAME A {AEA1371}>))
  :BLOCKS NIL
  :TAGS NIL
  :TYPE-RESTRICTIONS NIL
  :LAMBDA #<SB-C::CLAMBDA
          :%SOURCE-NAME SB-C::.ANONYMOUS.
          :%DEBUG-NAME (LET ((A 1))
                              )
          :KIND :ZOMBIE
          :TYPE #<SB-KERNEL:BUILT-IN-CLASSOID FUNCTION (read-only)>
          :WHERE-FROM :DEFINED
          :VARS (A) {AEA14B1}>
  :CLEANUP NIL
  :HANDLED-CONDITIONS NIL
  :DISABLED-PACKAGE-LOCKS NIL
  :%POLICY ((COMPILATION-SPEED . 1) (DEBUG . 1) (INHIBIT-WARNINGS . 1)
            (SAFETY . 1) (SPACE . 1) (SPEED . 1))
  :USER-DATA NIL)

Example of use of ABBROLET:

CL-USER> (macrolet ((bar () 123))
           (cl-curlex:abbrolet ((foo bar))
             (foo)))
123

Package exports several macros that do interesting stuff with current lexical environment:

N.B.: leaking is for reading purposes only, and *LEXENV* captures state of lexical environment as it were on enter to WITH-CURRENT-LEXENV, not as it is when *LEXENV* var is used - this is why in the "sophisticated" example B variable is not seen in *LEXENV* - it was not there, when we entered WITH-CURRENT-LEXENV, it was binded somewhere inside.

N.B.: Although the ultimate goal is to leak lexenv in all major implementations, the form of a *LEXENV* will be (intentionally) implementation specific.

N.B.: Is WITH-CURRENT-CC-LEXENV really necessary? After all, ANSI standard specifies, that one of the arguments to *MACROEXPAND-HOOK* function is lexical environment, in which macro is expanded. However, what it does not specify, is a way for a macro to actually access that variable, when macro is defined using DEFMACRO. And in fact, SBCL safely gensyms this variable away. So, the one, who wishes to access *LEXENV* in macros has 2 choices:

Main use-case for ABBROLET is to locallly INTERN some function or macro from one package to another, see e.g. my CL-LARVAL project to see, how it's used to define DSL locally.

    CL-USER> (abbrolet ((name1 other-package::name2))
               (name1 a b c))

TODO:


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-curlex

Author

Alexander Popolitov <popolit@gmail.com>

License

GPL

Description

Leak *LEXENV* variable from compilation into runtime

Version

0.3

Source

cl-curlex.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-curlex.asd

Location

cl-curlex.asd

Systems

cl-curlex (system)

Packages

cl-curlex-system


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-curlex/sbcl.lisp

Parent

cl-curlex (system)

Location

sbcl.lisp


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 cl-curlex/package.lisp

Dependency

sbcl.lisp (file)

Parent

cl-curlex (system)

Location

package.lisp

Packages

cl-curlex


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 cl-curlex-system

Source

cl-curlex.asd

Use List

Previous: , Up: Packages   [Contents][Index]

4.2 cl-curlex

Source

package.lisp (file)

Use List

Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-curlex.asd: The cl-curlex<dot>asd file
cl-curlex/package.lisp: The cl-curlex/package<dot>lisp file
cl-curlex/sbcl.lisp: The cl-curlex/sbcl<dot>lisp file

F
File, Lisp, cl-curlex.asd: The cl-curlex<dot>asd file
File, Lisp, cl-curlex/package.lisp: The cl-curlex/package<dot>lisp file
File, Lisp, cl-curlex/sbcl.lisp: The cl-curlex/sbcl<dot>lisp file

L
Lisp File, cl-curlex.asd: The cl-curlex<dot>asd file
Lisp File, cl-curlex/package.lisp: The cl-curlex/package<dot>lisp file
Lisp File, cl-curlex/sbcl.lisp: The cl-curlex/sbcl<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-curlex: The cl-curlex system
cl-curlex: The cl-curlex package
cl-curlex-system: The cl-curlex-system package

P
Package, cl-curlex: The cl-curlex package
Package, cl-curlex-system: The cl-curlex-system package

S
System, cl-curlex: The cl-curlex system

Jump to:   C   P   S