Arc Forumnew | comments | leaders | submitlogin
A solution for "unknown or expired link" ?
10 points by olavk 6132 days ago | 11 comments
I may be a bit out of my depth here, but...

If I understand the Arc web framework correctly, navigation state is handled by appending links (or forms) with an unique identifier which identifies a closure existing on the server. When the link is navigated, the server receives the ID and locates and executes the closure.

This have some serious drawbacks. You have to keep closures alive indefinitely, since the user might have bookmarked the URL, or Google might have indexed it. If you keep them in memory then all is lost if you restart the server: You users receive the dreaded "unknown or expired link" and your pagerank plummet. Millions in marketing are lost.

If you keep them in a database you have to manage a database that might grow very quickly - forever and ever.

Perhaps this can be alleviated with a different approach? Instead of using an ID to a closure, the URL could contain a reference to the function (not to a closure but to the name of the function) and the actual values of the bindings.

Basically you are serializing the closure to the URL. This allows you to keep the server stateless. You can recompile the script or restart the server without users noticing. You can scale to multiple servers without problems.

The bindings should probably be encrypted. The biggest issue I see is that the amount of data in the closure becomes too big. But not all user-specific information should be kept in closures anyway. Some information should be kept in session state (which should be tracked using cookies rather than URL's) .

Does this make sense?



6 points by pg 6132 days ago | link

That's not the only way to do navigation. You can also just use defop to write operators that take arguments in the usual way. Most things in News.YC work that way. I only use closures when I have to.

-----

3 points by olavk 6131 days ago | link

I suppose you never have to use closures, since you can always rewrite to use defop. But a major selling point of Arc seem to be the conciseness of building flows using macros like w/link. If this approach turns out to be not recommended for "real world use", I think it defeats the purpose and it would be fair to say that Arc itself fails the Arc-challenge.

I'd much rather change the underlying implementation of w/link to be more robust, if possible.

(Btw. it is only in the context of links I think long-lived closures are a problem. In the context of responses to form posts I don't think there is a problem, since these are not bookmarkable or indexed anyway.)

-----

2 points by pg 6131 days ago | link

You can also associate explicit lifetimes with closures on the server if you want. See the def of vars-form.

-----

2 points by ryantmulligan 6131 days ago | link

Your point about Page Rank is unfounded. Google doesn't look at pages it has already indexed to figure out Page Rank. It gathers a fresh copy then follows those links which would all work. And anyway, most of Page Rank is about other people linking to you.

-----

2 points by olavk 6129 days ago | link

If links stops working after a while, I'm pretty sure people will stop linking. And if not, visitors following the links will get a bad experience. You may be right that it wont hurt page rank directly, though.

-----

4 points by bayareaguy 6132 days ago | link

Do any lisp systems handle seralizing closures?

-----

4 points by absz 6132 days ago | link

Well, I know that Gambit-C, which is a Scheme dialect, (http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_P...) can; in fact, it can even serialize continuations.

-----

1 point by ryantmulligan 6130 days ago | link

I checked out Gambit-C but my question is, where is the community? It looks like it's just some guys research project, then some other researcher made Termite on top of it. It's community is either non-existent or in hiding, it would seem...

-----

1 point by absz 6130 days ago | link

That's a good question, and I have no idea--I just came across it because of Termite (which looks quite nice, by the way; those concurrency primitives [which are Erlang's, really] ought to be in Arc, but I digress). My point was really that it is technologically feasible to do so.

-----

1 point by ryantmulligan 6129 days ago | link

ah okay. You are saying it's possible to put this in Arc because it's in Gambit. Okay, sure. Gambit seems to be a much more performant implementation of scheme that Arc is striving to be. I think there is a lot to be said about serializing closures. Persistence is the nasty nasty dark secret of Computer Science. Our only tool that semi works is Relational Databases, but they aren't good for everything.

-----

1 point by CatDancer 6132 days ago | link

http://sisc-scheme.org/manual/html/ch05.html#SerialIO

-----