Skip to content

“invalid context within quasiquote” when using unquote-splicing in macro body #920

Description

@aartaka

So I’m writing an STklos port of SRFI 279. I mostly copied the existing (Chibi) impelementation where it uses SRFI 253 define-checked to define most procedures. And returns a quasiquote-constructed lists. However, such style results in a file that’s basically unparseable for STklos, emitting a bunch of errors, one per such define-checked:

compiler-error: invalid context within quasiquote. Call was (define-checked (vector-properties (object vector?)) `((vector-length ,(vector-length object)) ,@(map (lambda (Si Se) (list Si Se)) (iota (vector-length object)) (vector->list object))))

I was able to isolate it to the use of unquote-splicing / ,@ and hyg:untag-quasiquote in mbe.stk where the error text appears. However, I cannot understand the purpose of this procedure—why strip off quasiquotes if these are valid procedure bodies?

Example code to test on:

;; Depends on SRFI 253, but can be replaced with any macro?
(define-checked (vector-properties (object vector?))
  `((vector-length ,(vector-length object))
    ,@(map (lambda (i e) (list i e))
           ;; Depends on SRFI 1
           (iota (vector-length object))
           (vector->list object))))

@egallesio?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions