From c9788909eaf81e146f2909e3edd7f45ad3649782 Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Thu, 1 Dec 2011 12:37:52 -0700 Subject: [PATCH] [honu] fix for literal sets generated in a macro. replace . with -> for classes in the linq example --- collects/honu/core/private/util.rkt | 12 +++++++++--- collects/tests/honu/linq.honu | 18 +++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/collects/honu/core/private/util.rkt b/collects/honu/core/private/util.rkt index b75c854638..fadd73c82c 100644 --- a/collects/honu/core/private/util.rkt +++ b/collects/honu/core/private/util.rkt @@ -124,7 +124,13 @@ (let () (define-literal-set set (literal)) (define-syntax-class class - #:literal-sets (set) - ;; BUG! shouldn't need ~literal here since we are using literal sets - [pattern (~literal literal)]) + ;; The problem is that 'literal' is unmarked but 'set' is marked. + ;; The #:literal-sets option is kind of like a binding form: only identifiers + ;; having the same marks are treated as literals. + ;; The fix is + ;; #:literal-sets ([set #:at literal]) + ;; which means treat any identifier whose name is listed in 'set' and whose lexical context matches 'literal' as a literal. + ;; - Ryan + #:literal-sets ([set #:at literal]) + [pattern literal]) (reify-syntax-class class))) diff --git a/collects/tests/honu/linq.honu b/collects/tests/honu/linq.honu index e05bd41623..455d0871cb 100644 --- a/collects/tests/honu/linq.honu +++ b/collects/tests/honu/linq.honu @@ -36,16 +36,16 @@ starts_with(start, what){ var xml = loadXml("test.xml") printf("xml ~a\n", xml) -printf("data: ~a\n", xml.getData()) -printf("table1: ~a\n", xml.Descendants("Table1")) +printf("data: ~a\n", xml->getData()) +printf("table1: ~a\n", xml->Descendants("Table1")) struct test{name, address} -var addresses = linq from add in xml.Descendants("Table1") +var addresses = linq from add in xml->Descendants("Table1") where true - orderby add.Element("familyName").Value() - select test(add.Element("familyName").Value(), - add.Element("address").Value()) + orderby add->Element("familyName")->Value() + select test(add->Element("familyName")->Value(), + add->Element("address")->Value()) printf("addresses ~a\n", addresses) @@ -53,8 +53,8 @@ for add in addresses do { printf("name ~a address ~a\n", add.name, add.address) } -for xs in linq from foo in xml.Descendants("Table1") - where starts_with("x", foo.Element("familyName").Value()) - select foo.Element("familyName").Value() do { +for xs in linq from foo in xml->Descendants("Table1") + where starts_with("x", foo->Element("familyName")->Value()) + select foo->Element("familyName")->Value() do { printf("only x: ~a\n", xs) }