Arc Forumnew | comments | leaders | submitlogin
4 points by rntz 5407 days ago | link | parent

So it turns out '+ and '++ are actually special-cased in the ssyntax expansion process. From ac.scm:

    (define (ssyntax? x)
      (and (symbol? x)
           (not (or (eqv? x '+) (eqv? x '++) (eqv? x '_)))
           (let ((name (symbol->string x)))
             (has-ssyntax-char? name (- (string-length name) 1)))))
This is somewht ugly IMO, but it does mean that merely switching the order in which '. and '+ are ssexpanded fixes this particular bug:

    diff --git a/ac.scm b/ac.scm
    index 3304953..739a4f2 100644
    --- a/ac.scm
    +++ b/ac.scm
    @@ -89,9 +89,9 @@

     (define (expand-ssyntax sym)
       ((cond ((or (insym? #\: sym) (insym? #\~ sym)) expand-compose)
    +         ((or (insym? #\. sym) (insym? #\! sym)) expand-sexpr)
              ((insym? #\+ sym) expand-and)
          ;   ((insym? #\_ sym) expand-curry)
    -         ((or (insym? #\. sym) (insym? #\! sym)) expand-sexpr)
              (#t (error "Unknown ssyntax" sym)))
        sym))
Albeit it does change the semantics of some "correct" uses of ssyntax slightly (though not in a way I'd expect anyone to rely on); for example, 'foo+bar.baz expands to '(andf foo (bar baz)) under arc3, but expands to '((andf foo bar) baz) with this patch applied.