## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Show All Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

 Subject: Re: \box_if_empty:N(TF) From: Joseph Wright <[log in to unmask]> Reply To: Mailing list for the LaTeX3 project <[log in to unmask]> Date: Wed, 5 Jan 2011 22:10:19 +0000 Content-Type: text/plain Parts/Attachments: text/plain (53 lines)
On 05/01/2011 18:30, Frank Mittelbach wrote:
> well, I think we can clearly state that the l3box module is far from being
> what it should be, both in the sense of being incomplete as well as in the
> sense of being partly wrong or containing badly named commands. The above
> probably being an example of the latter.
>
> However, I'm not sure that "void" is the best word either.  Ok, there is the
> meaning "voiding something" ie making it invalid and to some extense that is
> what a void box register is: you can't do most of the operations on it. But
> there is also the meaning of void that is closer to empty and that is what I
> think makes both void and empty a bad choice as there is clearly also
> something like an empty hbox (\null) or \vbox{} ie a box that has no content
> but is set in terms of what input it could have had.
>
> maybe \box_if_unset:NTF is closer to its meaning.
>
> A similar question goes for \box_use_clear:N ... that boxed isn't "cleared" it
> is unset too afterwards.

First, a comment on the entire \box_use_clear:N (or whatever) concept:
I'm not a fan. Yes, this is the what TeX does, but it's far from
consistent with every other type of variable. I strongly favour sticking
to \box_use:N. As boxes are set (you can't add to them), even
\box_clear:N is not really as important as say \tl_clear:N

I had a look back through the current code, to think about things more
generally. One thing that stuck me is that \box_new:N gives a void box,
\box_use_clear:N gives a void box but \box_clear:N gives an empty
(h)box. To be honest, I'd have thought we might be better with:

- \box_new:N creates a box which is empty (an hbox)
- \box_clear:N makes the box empty (an hbox)
- \box_use_clear:N is either renamed as you suggest or is simply
dropped (unless there is some pressing need for it)

This would then mean that new boxes would be 'empty' using Heiko's test,
and that the only void/unset/whatever boxes would be 'special' ones such
as \l_last_box in some circumstances.

(Alternatively, should things be the other way around, with \box_clear:N
giving a void box? Is this doable without introducing something into the
typesetting stream?)

> Heiko's test for emptyness is testing for something quite different, isn't it?
> Not sure there is an application for it, but perhaps there is (but probably
> only if you provide other complex box manipulation commands as well)

I guess it depends on what is decided about the above, but in general I
can only see a need to test for void boxes coming from TeX (such as the
\l_last_box case I've mentioned).
--
Joseph Wright