[Top][All Lists]

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

Re: featurep

From: Kim F. Storm
Subject: Re: featurep
Date: 19 Mar 2002 14:39:37 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Richard Stallman <address@hidden> writes:

> I agree with the people who say this is not very clean:
>   The following special call returns t iff a given KEY VALUE
>   pair is supported on this system:
> !   (make-network-process :feature KEY VALUE)
> Couldn't this be done with featurep, using sub-features?
> Please try to design it that way.

I agree that it would be cleaner (in a purist sense) to have this work
through featurep, and technically there is nothing (serious) preventing
this from working.

However, for a usage point of view, I don't really see why it
matters, and IMHO, using featurep will be _less_ intuitive.
For example, I think using

  (if (and (make-network-process :feature :family 'local)
           (make-network-process :feature :datagram t))
to test whether make-network-process supports datagrams and the local
sockets is a lot easier to use (since those are the exact same
arguments which are used to select those features) than to test on
some similar, but not quite the same, symbols like

  (if (and (featurep 'networking 'local-sockets)
           (featurep 'networking 'datagrams))

To take this further, you can test whether a give socket option
is supported (without adding extra code at the C-level) with

  (if (make-network-process :feature :options 'oobinline)

whereas doing the same with featurep requires adding more
symbols and code to be able to say something like

  (if (featurep 'networking 'oobinline-option)

In fact, what you are asking is that I invent slightly different names
for all the various combinations of arguments to make-network-process,
just for the purpose of being able to use a standard way to test for
the availablility of those features.

Actually, if you accept to leave in the :featurep argument,
it would be possible to do this at the lisp level using code
like this:

  (let ((subfeatures nil))
     (if (make-network-process :featurep :datagram t)
        (setq subfeatures (cons 'datagrams subfeatures)))
     (if (make-network-process :featurep :family local)
        (setq subfeatures (cons 'local-sockets subfeatures)))
     (if (make-network-process :featurep :options 'oobinline)
        (setq subfeatures (cons 'oobinline-option subfeatures)))
     ;; etc...
     (provide 'networking subfeatures))

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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