Arc Forumnew | comments | leaders | submitlogin
Atstrings: escape problem
5 points by conanite 5561 days ago | discuss

  arc> (declare 'atstrings t)
  t
  arc> (assign bar "xxxx")
  "xxxx"
  arc> "foo @bar"
  "foo xxxx"
  arc> "foo @bar @@bar"
  "foo xxxx xxxx" ; <-- problem here, expected "foo xxxx @bar"
  arc> "foo @@plop"
  "foo @plop"
  arc> "foo @@bar"
  "foo @bar"
  arc> 
"foo @bar @@bar" compiles down to (string "foo " bar "@bar") ... but then "@bar" compiles down to (string "" bar), or equivalent, so you end up with (string "foo " bar (string "" bar)).

The cause is in (define (at-string ...)) in ac.scm, where ac is called recursively with the expanded string expression:

  (ac (cons 'string (map (lambda (x)
                           (if (string? x)
                               (unescape-ats x)
                               x))
                         (codestring s)))
this results in ac re-visiting each of the string fragments, including "@bar", which, naturally, ac feels should be expanded.