Arc Forumnew | comments | leaders | submitlogin
3 points by kens2 5876 days ago | link | parent

Ok, I'm stumped. What's the difference between arform and arformh? I thought arformh gave access to the headers, but they both do. arformh doesn't update save-optime, but I think that's just an accident. Why do these both exist?

Here's sample code:

  (defop prreq req (prn req))

  (defop a1 req (arform [do (prn "Set-Cookie: foo=234") "prreq"] (submit)))

  (defop a2 req (arformh [do (prn "Set-Cookie: foo=345") "prreq"] (submit)))
Going to /a1 or /a2 and clicking the button shows that both update the cookie and redirect to /prreq. So why are there separate arform and arformh macros?


2 points by almkglor 5876 days ago | link

My bet is, this is a thinko by pg. He planned to restrict arform to not emitting anything, but forgot to actually put the restriction.

The code for both forms are quite a few lines apart too.

http://www.paulgraham.com/gh.html section: recognition

Edit: after some time scanning through the code - it seems that arformh's time is measured, but arform's time is not. Or vice versa, I could've gotten confused.

Cref: rfnurl* and rfnurl2* . rfnurl* is "r", r is (defopr r ...), defopr is (... (defop-raw ...)), defop-raw is (... (save-optime ...))

rfunurl2* is "y", y is (defopr-raw y ...), defopr-raw doesn't add any code to the body: (fn ,parms ,@body)

-----