[honu] fix for literal sets generated in a macro. replace . with -> for classes in the linq example

This commit is contained in:
Jon Rafkind 2011-12-01 12:37:52 -07:00
parent 8bb8ac5859
commit c9788909ea
2 changed files with 18 additions and 12 deletions

View File

@ -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)))

View File

@ -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)
}