[squeak-dev] About Compiler-cmm.131
Chris Muller
asqueaker at gmail.com
Wed Mar 3 15:02:12 UTC 2010
Great so that's one vote for. But I am not seeing your tweaks, did
you update the inbox?
On Wed, Mar 3, 2010 at 6:32 AM, Juan Vuletich <juan at jvuletich.org> wrote:
> Hi Chris,
>
> Chris Muller wrote:
>>
>> Hi, I've just posted refinements to the inbox for pretty-print to
>> provide Rectangular Block and Indented Control Flow as suggested by
>> Ward Cunningham at:
>>
>> http://c2.com/ppr/formatting.html#2
>>
>> These formatting rules maximize readability while balancing screen
>> space (and methods should be short anyway). However, I did only push
>> these to the inbox for now, due to the potentially combustible nature
>> of this sort of change.
>>
>> Unless there are major objections, I'd like to copy these to the trunk
>> so we can all enjoy gorgeous Rectangular Block formatting.
>>
>> - Chris
>>
>
> Thanks! I love it! I did a couple of tweaks I hope you'll like:
>
> 1) Separate lines for block
> a) if block has arguments (as if it had temps)
> b) if the single statement is complex (as if it had many statements)
>
> 2) Brace arrays formatted as rectangluar blocks
>
> !BlockNode methodsFor: 'printing' stamp: 'jmv 3/3/2010 09:09'!
> printOn: aStream indent: level
> | separateLines |
> aStream
> nextPut: $[ ;
> space.
> self
> printArgumentsOn: aStream
> indent: level.
> separateLines := (self
> printTemporaries: temporaries
> on: aStream
> doPrior: [ ] ) or: [ arguments size > 0 ].
> separateLines ifTrue:
> [ "If args+temps > 0 and statements > 1 (or just one complex
> statement), put all statements on separate lines"
> (statements size > 1 or: [ statements size = 1 and: [statements first
> isComplex]])
> ifTrue: [ aStream crtab: level ]
> ifFalse: [ aStream space] ] .
> self
> printStatementsOn: aStream
> indent: level.
> aStream
> space ;
> nextPut: $]! !
>
>
> !BraceNode methodsFor: 'printing' stamp: 'jmv 3/3/2010 08:58'!
> printOn: aStream indent: level
> aStream
> crtab: level+1.
> aStream nextPut: ${.
> 1
> to: elements size
> do:
> [ : i |
> (elements at: i)
> printOn: aStream
> indent: level.
> i < elements size ifTrue:
> [ aStream
> nextPutAll: '. ' ;
> crtab: level+1 ] ].
> aStream nextPut: $}! !
>
> BTW, according to http://c2.com/ppr/formatting.html#2, the author is Kent
> Beck.
>
> Cheers,
> Juan Vuletich
>
>
More information about the Squeak-dev
mailing list
|