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

Re: About logging / reporting






On Mon, Aug 19, 2013 at 9:26 PM, John Cowan <cowan@xxxxxxxxxxxxxxxx> wrote:
Emmanuel Medernach scripsit:

> I don't  think you have  to thread it  through all your code, we have
> modules don't we ?

Yes, that was an irrelevance I shouldn't have brought up.


No problem.
 
> The  syslog interface  is very  similar to  a port interface  (in
> accordance  with  "Everything is  a file"'s Unix philosophy):
>
>   void openlog(const char *ident, int option, int facility);
>   void syslog(int priority, const char *format, ...);
>   void closelog(void);

But you'll notice that openlog() does not return anything recognizable
as a port, nor does syslog() accept anything like a port (unlike, say,
fprintf).  Really, what openlog() does is to override certain parameters
(in the Scheme sense) that syslog() examines; in turn, closelog()
restores the defaults.  The names "open" and "close" are very misleading.


Exactly, you are right.  This C function overrides
a hidden value. We have to cope with it.  The idea
is to  abstract syslog and  get access to it  as a
port through a function.

And  yes indeed,  'initialize' would  have  been a
better name.


> Currying 'syslog'  is sufficient to  obtain a true port interface :
>
>   (syslog-open ident option facility)
>   (syslog-get-port priority)
>   (syslog-close)


Yes, I suppose that will work.  But I wouldn't like to see it a
requirement of how to do syslog in Scheme, simply because of making this
API less flexible.


No, sure it is not  the goal here to standardize a
syslog abstraction.  Just  to emphasize that ports
are a useful abstraction, and IMHO very fitted for
this kind of interface.
 
> We digress,  but for  the sake of  WG2, I  am sure being able to
> create  and handle custom ports like with  Chicken or  Racket's
> 'make-input-port'  is a good thing to have.

I've been thinking about that, but I have not been able to come up with a
sufficiently universal and yet usable SPI (service-provider interface) for
such ports.  We should move that part of the discussion to scheme-reports
or the WG2 list.


Good news ! I am looking forward to read
proposals about it.

--
Emmanuel