[Openmcl-devel] Lisp for the 21 century: how to deal with URLs
ron at awun.net
Sun Jun 7 23:39:53 PDT 2009
I like it!
(defun nsstr (s) (make-instance 'gui::ns-lisp-string :string s)) ;
Really ought to be built-in to CCL
(defun load-url (url)
(let ((data (make-instance ns:ns-data
:with-contents-of-url (#/URLWithString: ns:ns-url
(filename (format nil "/tmp/~a" (gensym))))
(#/writeToFile:atomically: data (nsstr filename) #$NO)
Implementing "save-url" is going to be trickier though :-)
On Jun 7, 2009, at 11:00 PM, Alexander Repenning wrote:
> It would be nice if we could bring Lisp into the 21 century by adding
> some kind of native support for URLs. For instance, with more and more
> people posting Lisp files by attaching them to emails how about being
> able to just load them via (load URL)? Chances are you already keep
> your files in some web accessible repository, e.g., Google Code/ svn
> At a conceptual level there is a question of how to integrate (or
> perhaps replace) the existing notion of CL pathnames with URLs. This
> will cause some headaches but could replace the portable logical
> pathnames with a long overdue modern approach.
> At an implementation level, in CCL, one could start by hacking load.
> If the pathname is a string starting with "http://" then the chance is
> pretty good that we are dealing with a URL
> (load "http://xmlisp.googlecode.com/svn/trunk/XMLisp/sources/IDE/specific/Mac%20CCL/anticipat-symbol-complete.lisp
> The file could be downloaded via HTTP, perhaps as temp file, and then
> loaded the "old" way. Even here there are questions. Should one use
> CFNetwork? URLDownload looks temptingly simple but depreciated,
> NSURLDownload hmmmm.... just use TCP streams and make you own HTTP
> GET, ... so many options.
> With a bit more work one could do some clever local caching similar to
> Google Gears.
> Any suggestions?
> Prof. Alexander Repenning
> University of Colorado
> Computer Science Department
> Boulder, CO 80309-430
> vCard: http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel