Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • cmucl cmucl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 57
    • Issues 57
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cmucl
  • cmuclcmucl
  • Issues
  • #7
Closed
Open
Issue created Jun 23, 2015 by Raymond Toy@rtoyOwner

Local functions and get-setf-expansion

Consider this bit of code (from CLHS with a few corrections):

(defmacro xpop (place &environment env)
  (multiple-value-bind (dummies vals new setter getter)
      (get-setf-expansion place env)
    `(let* (,@(mapcar #'list dummies vals) (,(car new) ,getter))
      (if ,(cdr new) (error "Can't expand this."))
      (prog1 (car ,(car new))
	(setq ,(car new) (cdr ,(car new)))
	,setter))))

(defsetf frob (x) (value) 
     `(setf (car ,x) ,value))

(let ((z (list 1 2)))
  (flet ((frob (x) (cdr x)))
    (xpop (frob z))))

The CLHS says that that is invalid, but doesn't say why. I assume it's because frob is shadowed by the flet.

I think cmucl doesn't do this correctly because it doesn't look up the function name correctly.

Assignee
Assign to
Time tracking