Arc Forumnew | comments | leaders | submitlogin
1 point by conanite 5589 days ago | link | parent

My favourite topic!

You'll also need to watch out for this:

  arc> (declare 'atstrings t)
  #<void>
  arc> (assign user "conanite")
  "conanite"
  arc> "/Users/@user"
  "/Users/conanite"
  arc> "/Users/@user/file.arc"
  Error: "reference to undefined identifier: _user/file"
  arc> 
I confess, this is a seriously contrived example: nested strings need to be escaped -

  arc> "database/@(+ user "_file.arc")"
  Error: "UNKNOWN::0: read: expected a `)'"
  arc> Error: "reference to undefined identifier: __file"
  arc> ")"

  arc> "database/@(+ user \"_file.arc\")"
  "database/conanite_file.arc"
  arc>
This is because arc relies on the scheme reader, which doesn't know anything about atstrings; the arc compiler later compiles "a @b c" into (string "a " b " c"). "\@" isn't a valid string escape sequence in scheme, so arc has to use "@@" instead.

I know this is more than you asked, but I just had to vent :)

[forum hint] Indent code samples with two spaces and delimit with blank lines to get it to format properly



1 point by lg 5588 days ago | link

whoops, I forgot about the formatting and now it's too late to edit.

Maybe my original problem wasn't important then. Also it seems like your first problem means there should be more parens for disambiguation. "x/@(y)/z" or "x/@((funcall))/z" etc. "add more parens" always seems too easy to be right, though :)

-----