Arc Forumnew | comments | leaders | submitlogin
Is there a way to 'escape' ssyntax?
4 points by akkartik 5646 days ago | 5 comments
I'm trying to get into PLT exceptions with functions like exn:srclocs? http://docs.plt-scheme.org/reference/exns.html#(def._((quote._~23~25kernel)._exn~3asrclocs~3f)) but function composition has taken over the : character.


1 point by fallintothis 5646 days ago | link

No dice in vanilla Arc. There are only a couple of places ac doesn't call expand-ssyntax: in a function's argument list, quoted forms, and the variable of an assign. You'd need to patch ac.scm. For example, you could insert a global flag suitable for (declare 'ssyntax t/nil):

  @@ -57,8 +57,11 @@
         (number? x)
         (eq? x '())))

  +(define ssyntax #t)
  +
   (define (ssyntax? x)
     (and (symbol? x)
  +       ssyntax
          (not (or (eqv? x '+) (eqv? x '++) (eqv? x '_)))
          (let ((name (symbol->string x)))
            (has-ssyntax-char? name (- (string-length name) 1)))))
  @@ -1420,6 +1423,7 @@
   (xdef declare (lambda (key val)
                   (let ((flag (not (ar-false? val))))
                     (case key
  +                    ((ssyntax)        (set! ssyntax        flag))
                       ((atstrings)      (set! atstrings      flag))
                       ((direct-calls)   (set! direct-calls   flag))
                       ((explicit-flush) (set! explicit-flush flag)))
You could also modify ssyntax? to check specific symbols it shouldn't mess with. It already does this with +, ++, and _. You might just xdef the exception functions to different names, like exn-srclocs.

-----

1 point by shader 5645 days ago | link

Yeah, I guess I'm too used to using Anarki ;)

But if you made the changes as you suggested to ssyntax, then it would be easy enough to define a (w/o-ssynatax body) macro to temporarily disable ssyntax for a particular call.

-----

1 point by akkartik 5645 days ago | link

Oh, so the ssyntax implementation in anarki would permit PLT functions with colons in them?

-----

1 point by shader 5644 days ago | link

From my preliminary tests, it seems that using

  (($ fn:name) arg1 arg2)
works just fine, though ($.fn:name arg1 arg2) doesn't.

So, yes, you can use PLT functions with ssyntax on Anarki

-----

1 point by shader 5646 days ago | link

Well, since it's a scheme library function I should think that you'd be accessing it with '$ or 'mz, both of which (if I remember correctly) send all of the symbols in their arglist directly to scheme without any arc transformations first.

So ($.exn:srclocs args) should work, or maybe just (($ exn:srclocs) args) presuming of course that you've loaded the requisite lib files.

-----