As part of our LaTeX3 work, we provide a consistent interface to TeX programming through the expl3 package. We've recently been discussing the TeX primitive \lastbox, which is used to inspect or unpack whatever just came before in the typesetting.
From a scan over various packages that use \lastbox, its use appears to be restricted (entirely, it seems) to constructions like
\setbox\foo=\lastbox
... % do something with box \foo
That is, there's no need to provide access to the read-only \lastbox variable itself, only a method by which the last box can be assigned to a TeX box for further processing; something like
\box_set_to_last:N \foo
... % do something with box \foo
% no such thing as \lastbox or equivalent
We'd propose to only provide the expl3 programmer with this method and promote that any \lastbox related functionality use \box_set_to_last:N instead. Does this seem sensible? Contrariwise, do you know of an actual use for \lastbox that doesn't involve a \setbox first?
\lastbox(not in outer vertical mode or in math mode where it's disallowed), all you get is nothing, if the last item is not a box; otherwise you get exactly that box, so nothing different from what you'd get without\lastbox. – egreg Sep 13 '11 at 12:01plain.texuses\lastboxin\m@ketabboxwithout\setbox. (I don't understand what DEK is doing in those macros.) – Bruno Le Floch Sep 13 '11 at 17:17\lastboxwithout\setboxin my texlive install (modulo some copies of the same macros elsewhere, and some clearly erroneous\box\lastboxat various places). – Bruno Le Floch Sep 14 '11 at 00:33