On Sun, 2 Dec 2007, Bill K. wrote:
The particular case is a UI client library whose widgets are
hosted on a remote window server. The client is able to create
and initialize widget objects locally, without yet having
communicated with the remote server. Only when the instantiate!
method is finally called, do we go over the wire and instantiate
these widgets in the window server.
There is no non-! counterpart, but I feel the ! is very
appropriate for this method.
My immediate thought, as a user of the method, would be: why? If
it’s not part of a pair, then the ! is usually a sign that it should
be named something else – something where the name itself tells you
about what’s happening (like push and pop).
I don’t mean to sound like the ! police. It’s just that I’ve never
seen a usage pattern that, in my opinion, came close to being as
useful and elegant as the one Matz employs and recommends. The
problem, basically, is that the ! itself has no meaning. It’s not even
as meaningful as ?, which fairly clearly connotes a boolean. So the !
is entirely what we make of it, and I haven’t seen any improvements to
the approach Matz takes among the variants of usage. As a general,
contextless warning sign, it’s hopelessly unclear and impossible to
interpret. In !/non-! pairs, it starts to be able to say something.
The only standalone ! methods I can recall seeing that made sense to me
are the ones in Builder, by Jim W., where the ! is a kind of
escape from having the method name be automatically used as the name
of an XML element. Come to think of it, those aren’t really
standalone, since the equivalent non-! methods do exist.