[Top][All Lists]

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

RE: delete-windows-on

From: Drew Adams
Subject: RE: delete-windows-on
Date: Fri, 2 Oct 2009 09:47:15 -0700

> From: Juanma Barranquero Sent: Friday, October 02, 2009 9:31 AM
> > 3. It raises an error if you pass the name of a non-existent
> > buffer, or if you pass anything that is not a string or a
> > buffer (except nil - see #2). Why? Why doesn't it just do
> > nothing if the BUFFER arg is not an existing buffer or its
> > name?
> >
> > A nil value of BUFFER means there is no such buffer. The 
> > same is true of a string that doesn't name an existing
> > buffer. The same is true of a non-string such as the
> > number 42. In one case (#2), we currently do nothing and
> > return nil; in all other cases (#3), we currently raise
> > an error. That's not very consistent.
> I think it is quite consistent. Passing "whatever" (when "whatever"
> exists) is a clear way to say 'act upon "whatever"'. Passing nil (or
> omitting the 1st arg) clearly says "act upon the default buffer".
> IMHO, passing 42 or "nonexistent-buffer-name" clearly means "Oops,
> someone or something just fucked up".

1. What "default buffer"? No such default is defined/implemented here, AFAICT.

If nil actually stood for the "default buffer" here (whatever that might mean),
then passing nil would delete the window of the "default buffer". It does not do
that - passing nil does nothing.

2. Besides, it is not the purpose of `delete-windows-on' to determine whether
the BUFFER arg in fact corresponds to an existing buffer or someone just fucked
up. Its purpose is to delete a window (or do nothing). We have other ways to
test whether an object is a buffer. (And those ways do _not_ consider nil to be
a buffer, BTW.)

3. Besides even that, the point is that there is a design choice to make wrt:

a. What to return, and whether the return value is significant (hence
documented) or the function is instead called only for its side effect.

b. What to do when BUFFER does not represent a buffer. Raise an error? Do

Whatever choice is made, the documentation should reflect it.

4. You claim that nil represents a buffer here. I don't think that's in fact the
case. But even if it were, the above choices would still need to be made. (And
just which buffer nil represents would need to be documented.)

Please read the entire mail I sent.

reply via email to

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