[NIT] Pretty pretting #ifFalse:ifTrue:

Bijan Parsia bparsia at email.unc.edu
Tue Nov 20 22:44:56 UTC 2001


On Tue, 20 Nov 2001, Andrew C. Greenberg wrote:

> On Monday, November 19, 2001, at 10:57  PM, Richard A. O'Keefe wrote:
> 
> > 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 agree with that understanding of pretty printing, so it's at least
*that* general :))

> I never found use for a pretty printer, except perhaps to facilitate the 
> reading of large hunks of awfully written code.

It's really great for that. But note here how "formatting" pp is different
from "colorizing" pretty print (where "color" includes bolding and italics
:))...Some amount of colorizing can be useful even if you don't want your
code munged (e.g., even in "plain" source browsing, the selector/argument
line is bolded, and STP had a goodie that made comments red, etc.).


>  To that end, any 
> decent-looking semantically equivalent code sufficed.

As long as you don't want to modify it :)

>  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.

It's also used to generate the alternative syntax, and the same parse tree
is, I believe, used for tiles too.

Even if you don't use, or want to use, pretty printing, that parse tree is
going to be used for a variety of things, and it doesn't seem sufficient,
for the reasons mentioned earlier.

> Thus, I am curious why some are so interested in this functionality.  
> Have I been missing out on the party all these years?

Yep. :)

>  Perhaps there 
> could be some utility to such a tool, say, to impose coding standards on 
> a development team, or to ease code typing to free coders from some 
> extra keypresses.  Is that what folks use pretty-printing for?

That's certainly one reason. I bumped on it because I'm trying to generate
HTML versions of methods, and the tool I'm using works off the parse
tree. That seems to be the *style* for these sort of output tools, in
Squeak. If we're going to go that route for most things, the parse tree
needs to be up to snuff.

(On of the simplest uses is to convert _ to := (or vice versa).)

Cheers,
Bijan Parsia.





More information about the Squeak-dev mailing list