Arc Forumnew | comments | leaders | submitlogin
2 points by absz 5970 days ago | link | parent

See http://arclanguage.org/item?id=7595 — we can make it work already.


2 points by eds 5968 days ago | link

Really? What if you want to use destructive-named functions with the current meaning of '.', '!' and ':'? E.g.

  (join.a.b)
Assuming s/join/join!/ this becomes:

  (join!.a.b)
And thus the destructive-named '!' isn't at the end of the string anymore, is it? Or do you have something else in mind?

-----

1 point by almkglor 5968 days ago | link

  (require "ssyntaxes.arc")
  (def foo! (x)
    (= (car x) 42))
  (= hmm '(3))
  foo!.x
Well, it has to do with the ssyntaxes.arc precedence rules and how they work: basically, split according to the current ssyntax, then go to next ssyntax. Since #\. is listed before #\!, symbols are first split by #\. into (foo! x), so it works properly.

It won't work with a type that ends in ! and if you use the ? ssyntax:

  (def my-type! (x)
    (annotate 'my-type! x))
  (my-type!? my-type!.1) ; will transform to (my-type '?)

-----