chazu / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 1 forks source link

error with identifier-syntax #137

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the following program:

(import (rnrs))

(define-syntax identifier-syntax-accessor-mutator
  (syntax-rules ()
    ((_ ?thing ?accessor ?mutator)
     (identifier-syntax
      (_        (?accessor ?thing))
      ((set! _ expr)    (?mutator  ?thing expr))))
    ((_ ?thing ?accessor)
     (identifier-syntax (?accessor ?thing)))))

(define-syntax define-identifier-accessor-mutator
  (syntax-rules ()
    ((_ ?name ?thing ?accessor ?mutator)
     (define-syntax ?name
       (identifier-syntax-accessor-mutator ?thing ?accessor ?mutator)))
    ((_ ?name ?thing ?accessor)
     (define-syntax ?name
       (identifier-syntax-accessor-mutator ?thing ?accessor)))))

(let ((a 1))
  (define-identifier-accessor-mutator alpha a
    (lambda (x) x) set!)
  (write alpha)
  (newline))

;; (let ((a 1))
;;   (define-identifier-accessor-mutator alpha a
;;     (lambda (x) x))
;;   (write alpha)
;;   (newline))

;; (let ((a 1))
;;   (define-identifier-accessor-mutator alpha a
;;     (lambda (x) x) set!)
;;   (set! alpha 2)
;;   (write alpha)
;;   (newline))

What is the expected output? What do you see instead?
It should run and print values.  It fails with:

error in syntax template: too few ellipsis following subtemplate
  >  (((lambda (x) x) a) x ...)
  ..."/home/marco/var/tmp/proof.sps"
  @  x

expanding:
  >  (syntax (((lambda (x) x) a) x ...))
  ..."/home/marco/var/tmp/proof.sps"
  *  (identifier-syntax-accessor-mutator a (lambda (x) x) set!)
  ..."/home/marco/var/tmp/proof.sps"
  *  (define-identifier-accessor-mutator alpha a (lambda (x) x) set!)
  ..."/home/marco/var/tmp/proof.sps" line 24

What version of the product are you using? On what operating system?
Ypsilon revision 503.  i686-pc-linux-gnu.

Original issue reported on code.google.com by mrc....@gmail.com on 27 Mar 2010 at 7:45