PackageDescription: Show C like Source


Show C like Source

Last published: October 12, 2011 by 'michael'

Defines 2 Classes
Extends 20 Classes


It might be strange I had, but: occasinally I go to a customer and teach newbies Smalltalk. One of the difficulties some of the newbies I taught earlier was that they claimed not to understand the confusing syntax. So I had the idea to create a (so far read-only (or you might say read-never) C like representation. It hooks into the RB and adds a pane to show the C like Syntax.

Please be aware that this is thus a first protoype. I will start experimenting with it now and the "pseudo-C" Syntax is subject to motifications.

Here comes an example:

ANY awfulClikeSourceOn:indent: (ANY aStream, level)
/*Print the temps and body of a method*/
{
aStream -> nextPutAll:(" {");
body -> isEmpty() -> ifFalse:( {
aStream -> crtab:(level);
body -> awfulClikeSourceOn:indent:(aStream, level)});
aStream -> nextPut:( '}')}

And here is the original for those of you who have no idea what this should mean:

awfulClikeSourceOn: aStream indent: level
"Print the temps and body of a method"
aStream nextPutAll: ' {'.
body isEmpty ifFalse:
[aStream crtab: level.
body awfulClikeSourceOn: aStream indent: level].
aStream nextPut: $}