[racket] require url?

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Apr 15 00:34:29 EDT 2011

5 hours ago, Greg Hendershott wrote:
> > I suggested it a while ago, and there are still some questions
> > that are difficult to answer.  One issue is caching -- you'll
> > obviously need some cache, since files can be accessed many times
> > (eg, use a simple macro that prints a line and run it in
> > drracket), and the question is what caching policy should be used.
> > The main problem is how to differentiate the developer from the
> > user -- in the latter case it's probably fine to poll the URL
> > every some time (maybe once every hour, possibly with a way for
> > the author to control the frequency), but the developer should be
> > able to have a very high refresh frequency to allow fixing bugs
> > and checking them.  That's probably not too problematic if the
> > system is completely transparent and works exactly the same for
> > files from a url and local files -- this way the developer can
> > test files directly on the FS, while users get the hourly (or
> > whatver) updates.
> Possibly the usual HTTP caching mechanisms would suffice, including
> ETag (which is simply MD5 of the entity on some web servers)?
> If even such a light conditional GET were too much overhead for a
> normal user?

Yes.  A lightweight GET is still a huge cost.

> Then maybe (require (url ...)) takes an optional arg to do it, which
> I use as a dev.

That doesn't work -- imagine that you're editing code locally, so you
add that flag, but then you also need to add it to other files in the
same directory etc.  It should really be the same code that runs for
you and for your users.  (It might make sense to add some environment
based flags, but the code should not change.)

> Otherwise it defaults to HTTP expiration time caching, where the
> server suggests a good time to get back to it, as it probably knows
> best.

IIRC from my latest tweaks of our server, most servers won't suggest
an expiration time.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.