[NIT] Pretty pretting #ifFalse:ifTrue:

Bijan Parsia bparsia at email.unc.edu
Mon Nov 19 20:32:23 UTC 2001


On Mon, 19 Nov 2001, Andrew C. Greenberg wrote:

> Forgive me for being dense, Bijan, but I miss the point of your last 
> example.  Are you saying that these expressions are NOT semantically 
> equivalent, or that you find it difficult -- as a matter of coding 
> practice -- that the pretty printer changes your code around 
> syntactically?

It's not just that it changes my code around, it's the way it *deletes*
bits!

I was trying to point out that it doens't *always* substitute semantic
equvialents for semantic equivalents, even where the de facto difference
in syntax is minor (e.g., the returning the whole conditional
vs. returning from each block). In other words, the pragmatics are screwed
:)

I use different idioms to communicate something to the human
reader. ifFalse:ifTrue vs. ifTrue:ifFalse makes a difference to the
fluency of code. 

>  I agree with the latter statement, which is why I don't 
> use prettyprinting (apart from use as a tool to understand someone 
> else's spaghetti code).

If it just did indentation, etc. I wouldn't object. It's not just changing
the formatting of the code, it's changing the code! 

I don't know if I have any more point that that :) I don't *care* if it's
semantically equivalent, I want it to be *my code*, even if somewhat
reformatted! Especially where there may be pragmatic (in the sense of
linguisitc "pragmatics") reasons for using a construct (i.e., because I
want to *highight* the returning of nil if the bool is false). It'd be
like eliminating the ^self at the end of a method...

...which, it turns out, pretty printing does :) Oops.

Sorry, code disappearing on me freaks me out!

Cheers,
Bijan Parsia.





More information about the Squeak-dev mailing list