emacs-devel
[Top][All Lists]
Advanced

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

Re: ELisp futures and continuations/coroutines


From: Ted Zlatanov
Subject: Re: ELisp futures and continuations/coroutines
Date: Tue, 24 May 2011 21:17:51 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

On Sat, 21 May 2011 00:49:09 +0900 SAKURAI Masashi <address@hidden> wrote: 

SM> I employed the anaphoric macros to simulate the method chains in
SM> conventional OOP languages or the "do" syntax in Haskell. I feel
SM> that it is not so good too. I would learn the better ideas.

Perhaps you can use macros to simplify things, so instead of 

 (deferred:$
   (deferred:url-retrieve "http://www.gnu.org";)
   (deferred:nextc it
     (lambda (buf)
       (insert (with-current-buffer buf (buffer-string)))
       (kill-buffer buf))))

the user could say (when we're specifically working with URL retrieval)

(deferred:do-url
  "http://www.gnu.org"; ;; string implies url-retrieve
  ;; lambda implies "nextc it" so the following two are equivalent
  (lambda (buf) ...)
  (nextc it (lambda (buf) ...))

but this is just an idea.  I don't mean to tell you how it should work
and IMO it's usable as is.  Other, more experienced Lisp programmers
should tell you what they think because I'm just a beginner.

Ted




reply via email to

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