From: Manuel Giraud
Subject: [CMUCL] a server-side macro
Date: 
Message-ID: <qs3r8nqfycc.fsf@yoko.inria.fr>
Hi, I'm new to Lisp and I'm trying to create a macro that can be used
to simply create a server. To this point, here's what I have:

8<---------------------------
(defmacro with-loop-server-socket (((var &rest sock-args) &rest
                                    stream-args) &body (forms decls))
  "An infinite server loop. VAR is bound to the socket used to talk
with the newly connected client. SOCK-ARGS are arguments related to
CREATE-INET-LISTENER \(typically port\) used to create the initial
listening socket. STREAM-ARGS are related to SYS:MAKE-FD-STREAM
\(typically input, output, type of element, buffering, etc.\)"
  (let ((abortp (gensym))
        (wait-sock (gensym)))
    `(let ((,wait-sock (create-inet-listener ,@sock-args)))
       (unwind-protect
           (loop (let* ((,abortp t)
                        (,var (sys:make-fd-stream
                               (accept-tcp-connection ,wait-sock)
                               ,@stream-args)))
                   ,@decls
                   (unwind-protect
                       (progn
                         ,@forms
                         (setq ,abortp nil))
                     (when ,var (close ,var :abort ,abortp)))))
         (when ,wait-sock (close-socket ,wait-sock))))))
8<---------------------------

This one works, but I'd like to have some comments about it:

        - Two nested unwind-protect: is it good?
        - I don't much like the form:
                (with-loop-server-socket ((s 80) :input t) ...
          where it should be
                (with-loop-server-socket (s 80 :input t) ...

P.S. Any French from Paris here to say me where Paul Graham's "ANSI
Common Lisp" could be found.

-- 
Maude: What do you do for recreation?
Dude: Oh, the usual. Bowl, drive around. The occasional acid
flashback.

_Manuel Giraud_

From: Thomas F. Burdick
Subject: Re: [CMUCL] a server-side macro
Date: 
Message-ID: <xcvk7ti1fyf.fsf@conquest.OCF.Berkeley.EDU>
Manuel Giraud <······@sor.inria.fr> writes:

> P.S. Any French from Paris here to say me where Paul Graham's "ANSI
> Common Lisp" could be found.

Well, I'm not French, nor in Paris, but ... There's a technical
bookstore in the 8e arrondissement, I think on rue d'Amsterdam.  I
remember seeing a copy of "Object Oriented Common Lisp" and "On Lisp"
there, so I'd check there.  It'd be pretty odd to have the
out-of-print book by an author, but not his current in-print one.
Sorry I don't remember the name of the bookstore :)

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Dr. Edmund Weitz
Subject: Re: [CMUCL] a server-side macro
Date: 
Message-ID: <m3aduemxc8.fsf@dyn138.dbdmedia.de>
Manuel Giraud <······@sor.inria.fr> writes:

> P.S. Any French from Paris here to say me where Paul Graham's "ANSI
> Common Lisp" could be found.

<http://www.amazon.fr/exec/obidos/ASIN/0133708756>

-- 

Dr. Edmund Weitz
Hamburg
Germany

The Common Lisp Cookbook
<http://agharta.de/cookbook/>
From: Coby Beck
Subject: Re: [CMUCL] a server-side macro
Date: 
Message-ID: <cWda8.18662$A44.1049698@news2.calgary.shaw.ca>
"Dr. Edmund Weitz" <···@agharta.de> wrote in message
···················@dyn138.dbdmedia.de...
> Manuel Giraud <······@sor.inria.fr> writes:
>
> > P.S. Any French from Paris here to say me where Paul Graham's "ANSI
> > Common Lisp" could be found.
>
> <http://www.amazon.fr/exec/obidos/ASIN/0133708756>
>

also online now at http://www.paulgraham.com/onlisptext.html

--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")
From: Dr. Edmund Weitz
Subject: Re: [CMUCL] a server-side macro
Date: 
Message-ID: <m3k7tixycw.fsf@dyn138.dbdmedia.de>
"Coby Beck" <·····@mercury.bc.ca> writes:

> "Dr. Edmund Weitz" <···@agharta.de> wrote in message
> ···················@dyn138.dbdmedia.de...
> > Manuel Giraud <······@sor.inria.fr> writes:
> >
> > > P.S. Any French from Paris here to say me where Paul Graham's "ANSI
> > > Common Lisp" could be found.
> >
> > <http://www.amazon.fr/exec/obidos/ASIN/0133708756>
> >
> 
> also online now at http://www.paulgraham.com/onlisptext.html

No, that's Graham's other book.

Edi. 

-- 

Dr. Edmund Weitz
Hamburg
Germany

The Common Lisp Cookbook
<http://agharta.de/cookbook/>