Arc Forumnew | comments | leaders | submitlogin
2 points by rntz 5424 days ago | link | parent

'posmatch already does this.

    arc> (posmatch "cd" "abcde")
    2
Doing symbol macros by hijacking the ssyntax-expansion process seems hackish, and I'm not sure if it would work. Multibyte ssyntaxes could be interesting, though.

In arc3, pr."foo" and a!(b c) complain about bad ssyntax, so that bug at least has been squashed. Making them do "the right thing" would be pretty cool but would require some hacking of the reader - at the moment, ssyntaxes aren't expanded by the reader but by the arc compiler, which compiles symbols with ssyntax in them into special forms, so for example:

    arc> 'foo.bar
    foo.bar
    arc> '|foo.bar|
    foo.bar
If you wanted to handle ssyntaxes that weren't just special symbols correctly, you'd need to hack on the reader, which would change the above behavior to:

    arc> 'foo.bar
    (foo bar)
    arc> '|foo.bar|
    foo.bar
This might break some code, although probably not any code distributed with arc itself.


2 points by shader 5424 days ago | link

The idea of having symbol macros based on ssyntax was given to me by absz in http://www.arclanguage.org/item?id=9019

It doesn't seem too bad, hackwise, though I think it might have issues with layering new definitions on top of old ones if there isn't a way to remove them from the list.

What code would having that improved reader break?

-----

1 point by rntz 5424 days ago | link

Any code that relied on the ability to represent the symbol whose name is "foo.bar" (or any symbol containing a dot) as 'foo.bar rather than needing to wrap it in pipes as '|foo.bar|.

-----