[NIT] Pretty pretting #ifFalse:ifTrue:
Richard A. O'Keefe
ok at atlas.otago.ac.nz
Tue Nov 20 23:00:30 UTC 2001
> The general understanding of pretty-printing is that it should
> confine itself to adding and removing layout characters (space, tab,
> line break) and colouring.
I have no idea what is the "general understanding of pretty printing,"
so thus I shall defer.
I mean, of course, the literature on pretty-printing, going back as far as
the NPL pretty-printer and as current as the pretty-printing combinator
libraries for various functional languages. Grind, Blaise, Indent, PasMat,
... there's a lot of it about. Think Pascal was loved (and equally hated)
for pretty-printing on the fly in the IDE.
The other thing, where you take a parse tree and generate source code from
it, is conventionally called "unparsing" or sometimes "generation".
I never found use for a pretty printer, except perhaps to
facilitate the reading of large hunks of awfully written code.
Exactly so. There's a lot of it about.
To that end, any
decent-looking semantically equivalent code sufficed. Since even the
worst of Smalltalk code is usually much smaller and more comprehensible,
the pretty-printing tool seems particularly pointless in Squeak even as
a general editor.
Even Smalltalk has parentheses and brackets. Pretty-printing can be a
useful check that you have them in the right place. I have used it for
that purpose fairly often; the most important feature is the ability to
revert to the code the really beautiful (:-) way I had it before.
More information about the Squeak-dev
mailing list
|