Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
2f1d01e9
Commit
2f1d01e9
authored
34 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Changed MACROEXPAND and friends to hack LEXENV's as the environment arg.
In EVAL, call INTERNAL-EVAL on the non-expanded form.
parent
9422391b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/eval.lisp
+15
-12
15 additions, 12 deletions
code/eval.lisp
with
15 additions
and
12 deletions
code/eval.lisp
+
15
−
12
View file @
2f1d01e9
...
...
@@ -86,10 +86,10 @@
;;; *ALREADY-EVALED-THIS* is true, then we bind it to NIL before doing a call
;;; so that the effect is confined to the lexical scope of the EVAL-WHEN.
;;;
(
defun
eval
(
exp
)
(
defun
eval
(
original-
exp
)
"Evaluates its single arg in a null lexical environment, returns the
result or results."
(
let
((
exp
(
macroexpand
exp
)))
(
let
((
exp
(
macroexpand
original-
exp
)))
(
typecase
exp
(
symbol
(
symbol-value
exp
))
(
list
...
...
@@ -120,7 +120,7 @@
(
set
(
first
args
)
(
eval
(
second
args
))))
(
set
(
first
args
)
(
eval
(
second
args
)))))
(
unless
(
eq
(
info
variable
kind
(
first
name
))
:special
)
(
return
(
eval:internal-eval
exp
))))))
(
return
(
eval:internal-eval
original-
exp
))))))
((
progn
)
(
when
(
>
args
0
)
(
dolist
(
x
(
butlast
(
rest
exp
))
(
eval
(
car
(
last
exp
))))
...
...
@@ -135,7 +135,7 @@
(
let
((
*already-evaled-this*
nil
))
(
apply
(
symbol-function
name
)
(
args
)))
(
apply
(
symbol-function
name
)
(
args
))))
(
eval:internal-eval
exp
))))))
(
eval:internal-eval
original-
exp
))))))
(
t
exp
))))
...
...
@@ -189,8 +189,13 @@
(
if
info
(
let
((
source
(
first
(
c::compiled-debug-info-source
info
))))
(
cond
((
eq
(
c::debug-source-from
source
)
:lisp
)
(
values
(
c::debug-source-name
source
)
nil
name
))
(
let
((
def
(
c::debug-source-name
source
)))
(
if
(
and
(
consp
def
)
(
eq
(
car
def
)
'function
))
(
let
((
def
(
cadr
def
)))
(
if
(
and
(
consp
def
)
(
eq
(
car
def
)
'lambda
))
(
values
def
nil
name
)
(
values
nil
t
name
)))
(
values
nil
t
name
))))
((
stringp
name
)
(
values
nil
t
name
))
(
t
...
...
@@ -233,27 +238,25 @@
;;; Macroexpand-1 -- Public
;;;
;;; The Env
arg may actually be the compiler *fenv* alis
t.
;;; The Env
is a LEXENV or NIL (the null environmen
t.
)
;;;
(
defun
macroexpand-1
(
form
&optional
env
)
"If form is a macro, expands it once. Returns two values, the
expanded form and a T-or-NIL flag indicating whether the form was,
in fact, a macro. Env is the lexical environment to expand in,
which defaults to the null environment."
(
let
((
fenv
#|(if (listp env) env
(lexical-environment-fenv env))|#
env
))
(
let
((
fenv
(
when
env
(
c::lexenv-functions
env
))))
(
if
(
and
(
consp
form
)
(
symbolp
(
car
form
)))
(
let
((
local-def
(
cdr
(
assoc
(
car
form
)
fenv
))))
(
if
local-def
(
if
(
and
(
consp
local-def
)
(
eq
(
car
local-def
)
'MACRO
))
(
values
(
funcall
*macroexpand-hook*
(
cdr
local-def
)
form
f
env
)
form
env
)
t
)
(
values
form
nil
))
(
let
((
global-def
(
macro-function
(
car
form
))))
(
if
global-def
(
values
(
funcall
*macroexpand-hook*
global-def
form
f
env
)
(
values
(
funcall
*macroexpand-hook*
global-def
form
env
)
t
)
(
values
form
nil
)))))
(
values
form
nil
))))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment