emacs-devel
[Top][All Lists]
Advanced

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

Re: featurep


From: Kim F. Storm
Subject: Re: featurep
Date: 20 Mar 2002 00:48:40 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

"Stefan Monnier" <monnier+gnu/address@hidden> writes:

> > Ok, but if you combine :family 'local and :datagram t, and
> > make-network-process returns nil, you really don't know whether it's
> > because it doesn't support local sockets or datagrams -- so what would
> > you try next?
> 
> Why does it matter ?
> What would the code look like using your :feature thing ?

Probably not a lot different, but without checking for a feature
first, the current code will throw an error for an unsupported feature
indicating (in clear text) what the problem is.

Suppose you write a package using datagrams, and don't handle the case
where it returns nil (as you suggest).  In that case, a user of your
package will just see things not working (which he can report to you
as "it doesn't work"), rather than make-network-process throwing a
"datagrams not supported" error (which will probably give you a better
understanding of the problem when he reports that to you).


> Most likely your code can handle a small fixed number of different
> combination of features.  It can use :feature to decide which one
> of the alternatives to choose or it can just try them in order
> until one of them succeeds.
> I.e. I don't see how the "what would you try next" question is relevant
> since the problem also shows up with :feature.

No, but I disagree with the return nil and try next approach.

> 
> > In any case, I disagree, but I don't want to be religious about this,
> > so I'll change the code to use featurep.
> 
> Is it even necessary ?
> I expect that "try-it-and-see" will already catch all relevant cases.

So, yes, if you as a package author is aware of the possibility that
make-network-process returns nil on some systems for some combination
of features, than everything's fine.  But if some other package author
isn't aware of this, it can be a hard bargain trying to figure out
what went wrong (as the author and the user obviously are not on the
same platform).

> I'm really not convinced that we need anything more, so I wouldn't
> bother with anything more until there's some evidence that it
> is needed.  Of course, maybe you have that evidence, but I haven't seen it.

IMO, being such a multi-facetted beast, make-network-process should
throw exceptions when an unsupported feature is used.  If it didn't
do that, debugging code using it would be difficult.  Your proposal
takes that away (to remove a useful, but unclean :feature :-).

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




reply via email to

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