PackageDescription: Out


Out

Last published: April 12, 2011 by 'tgriggs'

Defines 0 Classes
Extends 5 Classes


This package adds the messages #out and #stdout to Object and a couple of appropriate subclasses.

It gets tedious writing Transcript show:, or print:, and with the cr, and possibly having to endEntry so you can see it NOW. Send #out to any object, and it will emit the objects printString on the Transcript, add a cr, and make it show up NOW.

Send #stdout to any object, and the object's printString will be emitted to the stdout stream. To see this on Windows, you must use the vwntconsole.exe Virtual Machine.

In all cases, the original object is still returned, so you can insert this as handy debug statements without affecting the flow of the caller otherwise.

Two handy specializations are the implementations on BlockClosure and Context.

[aStatement] stdout

adds error handling to the block, this is handy when you're inserting a statement in a critical piece of code where you're not quite sure if it won't bring the image down. The result of the block will be printed, but if an error occurs during the block, the errorString of the exception will be printed instead.

You may also send (std)out: anInteger to a Context. This will print the stack trace to a depth of anInteger. If you're trying to log not just that a method is being invoked, but where it's coming from, you can use an expression like:

thisContext stdout: 15