Skip to content

Expansion of templates with leading ellipsis - do not allow invalid templates #1013

@jpellegrini

Description

@jpellegrini

Hello!

From what I understand of R7RS, the templates beginning with ellipses, like (... a b c etc) are expressed as a list, but not expanded as one (that is, they should be spliced into the code generated from the template).

A template of the form (<ellipsis> <template>) is identical to <template>, except that ellipses within the template have no special meaning

That the text says "(<ellipsis> <template>) is identical to <template>" seems to indicate that the list should be spliced (no?)
Also,

In particular, the template (<ellipsis> <ellipsis>) produces a single <ellipsis>

seems to be concordant with that.

For example:

(define-syntax f
    (syntax-rules ()
      ((f) '(a b (... c ... d) e))))

would splice the (c ... d) list into the expanded form:

(f) => (a b c ... d e)

But Chibi seems to not splice the list:

(define-syntax f
   (syntax-rules ()
     ((f) '(a b (... c ... d) e))))

(f) => (a b (c ... d) e)

unless it's a single ellipsis (?)

(define-syntax f
    (syntax-rules ()
      ((f) '(a (... ...) b))))

(f) => (a ... b)

Maybe I didn't get some detail (sorry for the noise if this is the case).

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