emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more url-utils?


From: Lars Magne Ingebrigtsen
Subject: Re: more url-utils?
Date: Mon, 30 May 2011 19:31:50 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> How 'bout: the result of url-fetch (either returned in passed to the
> callback), is list of the form (STATUS . INFO): if STATUS is nil, it
> means the call was a success and INFO is an alist of auxiliary info such
> as headers and stuff, and if STATUS is non-nil, it should be an error
> symbol and INFO is some failure information such that one can do
> (signal (car result) (cdr result)).

Say you have a function that's supposed to do something with a web page,
`parse-page'.  The it would be very nice, I think, if the signature of
that function could be the same no matter whether we're fetching the
page synchronously or not.

That is, it would be nice if it were possible to say either

(apply #'parse-page (url-fetch "http://google.com";))

to do it synchronously or say 

(url-fetch "http://google.com"; 'parse-page)

to do it asynchronously.

This would imply that the signature used for callbacks should be
something like

(defun parse-page (buffer &optional status headers)
  ...)

Does that make sense?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]