|It's bothered me for a while now that ':' does double duty. At the start of a symbol it's part of the symbol, but inside it is an infix operator. I just found a way to avoid this: pun '+'! Now I can stop treating ':' as an infix char.|
The challenge in doing this was to figure out when '+' should mean compose. The first answer that comes to mind is, when the args are functions. But other types can also be coercible to functions (for using them in function position). So perhaps it should mean compose if the args are both coercible to function? But what if we later refine '+' for a type that is also coercible to function? What should win then?
The solution I went with was to compose only if one of the args is actually a function, without any coercions needed. I've never seen an example composing other types so far. The most I use so far is:
..where a is a list or hash table. That will continue to work. But let me know if you ever need to run:
(a (car x))
where neither a1 nor a2 are functions.
(a1 (a2 x))
Also, comments on the aesthetics of this choice most welcome. One way to overuse it:
('+' also joins lists and strings: http://arclanguage.org/item?id=17048.)
def (foo x)
(foo+car.x + foo+cdr.x)
Now that ':' has no infix duties, I can bring back comment tokens! http://arclanguage.org/item?id=16495
And I have another idea for it that I hope to show off soon.