Arc Forumnew | comments | leaders | submitlogin
3 points by almkglor 5968 days ago | link | parent

> This would be possible if there were easy ways to reprogram the Arc syntax in a library.

Again, like I said, this is probably implementable using readermacros, but fooling around with the reader is always troublesome.

Consider some random programmer who uses /ca/ as a variable name in his or her programs for some inexplicable reason. Whether this is considered a regular expression or a valid symbol will then depend on whether or not it is loaded before or after the regular expression library.

If you want nice regular expression syntax, then it must be standardized as part of the language syntax so that everyone knows they should avoid using such variable names. Alternatively, give some method for specifying a reader for each module file. No, this is an exploratory language, and someone will try using /ca/ as a variable name unless you specifically ban it. I promise you that.

This is only partially implementable using ssyntax, but again this may be considered as "fooling around with the reader".

If strings as regular expressions work for you, then it's okay, since strings are already standardized in the syntax:

  arc> ((rex "s/b(\\w)/d\\\\1/g") "bobcat")
  "dodcat"


4 points by cchooper 5967 days ago | link

Strings would work ok if Arc had a means of representing unprocessed strings like Perl or C#.

  arc> ((rex @"s/b(\w)/d\\1/g") "bobcat")
Has lots of other uses too, so I think this would be a good feature regardless.

-----

1 point by almkglor 5967 days ago | link

True, another good place would be docstrings.

Now all we need is to (re)build a reader for Arc. ^^

-----