[racket] sxml behavior: is this a bug?

From: John Clements (clements at brinckerhoff.org)
Date: Wed Feb 13 01:48:47 EST 2013

The sxml package has some strange behavior on DAGs. Before I go and try to fix it (or at least put a warning in the docs), I want to make sure it's a bug. 

The problem is that when a given node appears multiple times in an SXML document--that is, the eq?-same pointer--, calling sxml:modify to delete those nodes only deletes *some* of those instances.

#lang racket 
(require sxml)
(define zombie-node '(zombie))
(define t3 
 `(*TOP*
   (body
    (a ,zombie-node
       ,zombie-node)
    (b ,zombie-node
       ,zombie-node))))
(check-equal? ((sxml:modify '("//zombie" delete)) t3)
             `(*TOP* (body (a) (b))))

;; FAILS: produces (*TOP* (body (a (zombie)) (b (zombie)))) ... that is, half the zombies didn't die.

I claim the "most disgusting workaround of the week" award for my TeX-like solution of just calling sxml:modify again and again to get rid of them all... 

Anyhow, can any of the distinguished programmers familiar with this code confirm that this is not the desired behavior?

John

p.s.: sorry for the double-posting to three of you; my earlier message was sent with a bad From:, and got bounced from users.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4370 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20130212/5d0d2e40/attachment-0001.p7s>

Posted on the users mailing list.