[ANSI-Smalltalk] re: array creation syntax

Paolo Bonzini bonzini at gnu.org
Thu Apr 17 18:55:38 BST 2008


Andres Valloud wrote:
> Can you provide a specific bit of code?

My favorite example is formatted printing.  GNU Smalltalk implements the 
same #bindWith:, #bindWith:with:, ..., #bindWithArguments: methods as VA 
Smalltalk, but also provides a shortcut for them.  This is #%, whose 
name is inspired by Python.  Being able to write something like:

('%1: Unhandled exception (%2)'
     % { File executable stripPath. ex messageText }) printNl

is very nice.

Another example is Dictionary construction, where I have

Dictionary from: {
     #first -> runtime expression.
     #second -> (another + expression) }

I don't use this as much, but Squeak invented #newFrom: independently so 
the idea is not so weird.

Paolo




More information about the ANSI-Smalltalk mailing list