Just saying, I've looked at Factor (http://www.factorcode.org/) and I like what little I've seen of its OO mechanism. For example, when you call add (which adds the top element of the stack to the end of a sequence underneath), it ends up calling whatever add method the sequence defines.
In Arc, this would translate into the ability to define your own sequence type, and you could have your own definitions for operations like cut within the type definition.
Have you never seen a good implementation of singly-linked lists? Because accessing the last element is a relatively common operation, a decent implementation will keep a pointer to the last element. Because it's singly-linked, the last element is the only one that pointer is any good for, so (lst -2) is still O(n), but (lst -1) becomes O(1).
The weird thing is, I actually found this good idea in an APCS review book.
arc> (= a 3)
3
arc> (= b 5)
5
arc> (let a (+ a 4)
(+ a b))
12
arc> (with (a 2 b (+ b 2))
(+ a b))
9
arc> (with (a 6 b 2)
(prn a) (prn b)
(= b a) (= a 'foo)
(prn a) b)
6
2
'foo
6
arc> a
3
arc> b
5
The title of your post is misleading. I think when people saw "How to implement a no-side-effects macro" they read that as "How to implement macros with no side effects" rather than "macro that hides side effects from the surrounding scope".
You asked a simple question about lexical scoping. You got complex and confusing answers about macro hygiene. It is not that Arc has no easy answer to your lexical-scoping question, it is just that your simple question looks like a much harder one about macro hygiene.
Sorry I was unclear - I was indeed actually trying to ask a hard question.
I don't know a priori what variables this code will try to access. I could possibly figure that out with a macro, but some of the details are still unclear to me. I also don't want side effects if annotate, def, mac, or anything like that was run from the no-side-effect'd code.
At any rate, I think just wrapping in a let is insufficient, even if you do know all the variable names. E.g. you can break out of the sandbox with scdr:
Sorry, yes. My regular account name is Jesin, but the best proof I can offer is that while I don't have the password the account will remain inactive (unless of course someone else manages to get the password). I use that name for almost all of my online accounts, but I don't happen to have an account at Hacker News yet.
As I said, I think I put my email address on my profile for that account, so if I could access a verification-email-based password recovery system I'd be fine, but for some reason you need to be logged in to do that.
The major difference between return statements in other languages and ccc is that you can use any continuation that you can access, which means you can conditionally return to two different places in the code. As an example, here's a loop that supports "break" and "continue" (and can even break with a return value):
(mac my-loop body
`(ccc (fn (break)
(while t (ccc (fn (continue) ,@body))))))
Also, I need help. I can't use my regular account because I have forgotten my password and the only password recovery thing is only accessible when you are already logged in. I am pretty sure I put my email address on my regular account, so I don't see why I can't recover it. Please post any suggestions at http://www.arclanguage.org/item?id=4449