From 1d45a9ea6247b21c5b64bfa22445c18dcb2dee4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= <georges.duperon@gmail.com>
Date: Tue, 30 Aug 2016 13:13:32 +0200
Subject: [PATCH] =?UTF-8?q?Added=20~mixin,=20which=20checs=20that=20its=20?=
 =?UTF-8?q?argument=20is=20indeed=20a=20mixin.=20Mixins=20can=20still=20be?=
 =?UTF-8?q?=20used=20by=20themeselves,=20but=20there's=20always=20the=20ri?=
 =?UTF-8?q?sk=20that=20they'll=20be=20seen=20as=20a=20pattern=20variable,?=
 =?UTF-8?q?=20if=20for=20some=20reason=20their=20identifier=20is=20not=20b?=
 =?UTF-8?q?ound=20to=20a=20mixin=20(forgot=20to=20export,=20wrong=20scopes?=
 =?UTF-8?q?=E2=80=A6)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 main.rkt                             |  2 ++
 private/define-syntax+simple-api.rkt |  2 +-
 private/mixin.rkt                    | 11 +++++++++++
 test/test-structure-options.rkt      |  6 +++---
 4 files changed, 17 insertions(+), 4 deletions(-)
 create mode 100644 private/mixin.rkt

diff --git a/main.rkt b/main.rkt
index 5aa415a..f8f976a 100644
--- a/main.rkt
+++ b/main.rkt
@@ -6,6 +6,7 @@
          "private/post.rkt"
          "private/global.rkt"
          "private/optional.rkt"
+         "private/mixin.rkt"
          (for-template "private/define-syntax+simple-api.rkt"))
 
 (provide #;define-splicing-syntax-class-with-eh-mixins
@@ -14,6 +15,7 @@
          (expander-out eh-mixin)
          ~seq-no-order
          ~no-order
+         ~mixin
          ~post-check
          ~post-fail
          ~nop
diff --git a/private/define-syntax+simple-api.rkt b/private/define-syntax+simple-api.rkt
index c4f9d8e..23bdffd 100644
--- a/private/define-syntax+simple-api.rkt
+++ b/private/define-syntax+simple-api.rkt
@@ -63,7 +63,7 @@
               (define (name stx2)
                 (syntax-parameterize ([stx (make-rename-transformer #'stx2)])
                   (syntax-parse stx2
-                    [(name . colon-stxclass) . body])))
+                    [(_ . colon-stxclass) . body])))
               (define (private-simple-api stx/arg attr-name/arg …)
                 (syntax-parameterize ([stx (make-rename-transformer #'stx/arg)])
                   (syntax-parse #'nothing
diff --git a/private/mixin.rkt b/private/mixin.rkt
new file mode 100644
index 0000000..2c2f312
--- /dev/null
+++ b/private/mixin.rkt
@@ -0,0 +1,11 @@
+#lang racket
+
+(require "no-order.rkt"
+         (for-syntax syntax/parse))
+
+(provide ~mixin)
+
+(define-eh-mixin-expander ~mixin
+  (syntax-parser
+    [(_ (~var mixin (static eh-mixin-expander? "an eh-mixin expander")))
+     #'(mixin)]))
\ No newline at end of file
diff --git a/test/test-structure-options.rkt b/test/test-structure-options.rkt
index 9547e08..6f351e8 100644
--- a/test/test-structure-options.rkt
+++ b/test/test-structure-options.rkt
@@ -73,11 +73,11 @@
                 {structure-kw-predicate-mixin}
                 {structure-kw-fields-mixin}}))
 
-;; ---------
-
 (define-splicing-syntax-class structure-kws
   (pattern {~seq-no-order {structure-kw-all-mixin}}))
 
+;; ---------
+
 (check-equal? (syntax-parse #'(#:instance #:? p)
                 [(:structure-kws)
                  (list* (attribute instance)
@@ -163,4 +163,4 @@ builder-style field declarations"
 ;;      body]))
 ;;
 ;; For speed, we could just copy the whole implementation in real-macro-name's
-;; definition, instead of calling simplified-macro-implementation.
\ No newline at end of file
+;; definition, instead of calling simplified-macro-implementation.