bugKawa - Bugs: bug #47862, define-syntax does not accept...

 
 

bug #47862: define-syntax does not accept formals when inside a define-library

Submitter:  Adrián Medraño Calvo <medranocalvo>
Submitted:  Thu 05 May 2016 08:51:03 PM UTC
   
 
Category:  Scheme language Severity:  3 - Normal
Item Group:  Compile-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 06 May 2016 08:45:33 PM UTC, comment #3: 

Indeed; the report comes from it working in the REPL but not in the code.  Thank you very much!

Adrián Medraño Calvo <medranocalvo>
Fri 06 May 2016 05:48:37 AM UTC, comment #2: 

hanks - I checked in a fix for this.

Note that define-syntax with a format parameter is not allowed by R7RS. Ideally, (import (scheme base)) should import a version that doesn't allow the formal parameter, while (import (kawa base)) should import a version that does.  Which means they would conflict (unless import has some special support when one definition is a super-set of another).

In any case, I'm not going to bother with two different definitions of define-syntax, at least not for now.

Per Bothner <bothner>
Group administrator
Thu 05 May 2016 08:53:37 PM UTC, comment #1: 

Corrected markup + balance parens:


;; Outside define-library:
(define-syntax (const1 stx)
  (syntax-case stx ()
    ((_ c cs ...)
     (syntax c))))
(display (const1 0 1 2 3 4))

;; Inside define-library:
(define-library (somelib)
  (import
    (scheme base)
    (kawa base))
  (export const2)
  (begin
    (define-syntax (const2 stx)
      (syntax-case stx ()
        ((_ c cs ...)
         (syntax c)))))
  (display (const2 0 1 2 3 4)))


Adrián Medraño Calvo <medranocalvo>
Thu 05 May 2016 08:51:03 PM UTC, original submission:  

The formal parameter may be specified to define-syntax when outside a define-library definition (Ex. 1) but, when inside define-library (Ex. 2) it throws the error: unbound location: lambda

;; Ex 1: outside define-library:
(define-syntax (const1 stx)
  (syntax-case stx ()
    ((_ c cs ...)
     (syntax c))))
(display (const1 0 1 2 3 4))

;; Ex 2: inside define-library:
(define-library (somelib)
  (import
    (scheme base)
    (kawa base))
  (export const2)
  (begin
    (define-syntax (const2 stx)
      (syntax-case stx ()
        ((_ c cs ...)
         (syntax c)))))
    (const2 0 1 2 3))

Adrián Medraño Calvo <medranocalvo>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by medranocalvo (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-07-28 bothner Assigned toNone bothner
        Open/ClosedOpen Closed
    2016-05-06 bothner StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code