arclanguage / anarki

Community-managed fork of the Arc dialect of Lisp; for commit privileges submit a pull request.
http://arclanguage.github.io
Other
1.17k stars 160 forks source link

Let names end with syntax chars #137

Closed shawwn closed 5 years ago

shawwn commented 5 years ago

This PR adds support for naming variables FOO! and BAR.

In particular, it's useful to be able to write macros like:

(def cat args
  (apply + "" args))

(mac cat! (var . args)
  `(= ,var (cat ,var ,@args)))
(let s ""
  (cat! s "foo")
  (cat! s " bar " 'baz)
  ...
  s)
akkartik commented 5 years ago

I won't be surprised if this uncovers some bugs. Should be a good stress test for our automated tests.

shawwn commented 5 years ago

Unfortunately (foo&~bar 1) now goes into an infinite loop in expand-compose. I can look into this tomorrow or revert it for now.

akkartik commented 5 years ago

Hmm, to me it looks like this bug predates your changes.

akkartik commented 5 years ago

Heh, it's also happening in arc 3.1!

shawwn commented 5 years ago

Ah. :) Good catch.

rocketnia commented 5 years ago

It doesn't look like these new identifiers play well with ssyntax yet:

arc> foo!!bar!
list->string: contract violation
  expected: (listof char?)
  given: #\!

I would expect this to ssexpand into (foo! 'bar!).