[ENH] (?) Pretty Printing

Dean_Swan at Mitel.COM Dean_Swan at Mitel.COM
Wed Jan 19 16:22:52 UTC 2000


This change formats code so that opening and closing brackets for a block are
aligned in the same column, and statements in the block are indented one tab
more than the block brackets.  For me this makes code far easier to read and
understand the control flow "at-a-glance".  I know this can be quite a religious
issue for some people, but still I'd like to know what people think about this
change.

This isn't exactly what I wanted, as I would still prefer to have single
statement blocks all on one line, but I couldn't figure out how to do this
easily and still get this formatting for multi-statement blocks, so I chose this
as the lesser of the two evils.

                                   Enjoy! (or not :-) )

                                   -Dean Swan
                                   dean_swan at mitel.com




'From Squeak 2.5 of August 6, 1999 on 19 January 2000 at 11:19:55 am'!

!BlockNode methodsFor: 'printing' stamp: 'DRS 1/19/2000 11:19'!
printOn: aStream indent: level

     "Modified to force alignment of opening and closing brackets in the same
column,
      and indent statements within a block by one additional tab.  drs
1/18/2000"


     aStream crtab: level.
     "statements size <= 1 ifFalse: [aStream crtab: level]."
     aStream nextPut: $[.
     aStream crtab: (level + 1).
     self printArgumentsOn: aStream indent: (level + 1).
     self printStatementsOn: aStream indent: (level + 1).
     aStream crtab: level.
     aStream nextPut: $]! !







More information about the Squeak-dev mailing list