help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Community sprint


From: David Given
Subject: Re: [Help-smalltalk] Community sprint
Date: Sat, 30 Sep 2006 02:06:53 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060909)

Mike Anderson wrote:
[...]
> I was warming to the first one. It looks like you're sending a block as
> a message, which is odd, but not too odd. To think of a method body as a
> block is very natural. Unfortunately, I've realized that it gives you no
> opportunity to name the parameters. I suppose you could have:

I may be missing something, but given that blocks *do* have named parameters,
and that you can figure out how many parameters a message has from looking at
the name, is there anything wrong with:

String addMethod: #join: doing: [ :aCollectionOfStrings |
        ...code here...
].

and:

String addMethod: #replace:with: doing: [ :source :dest |
        ...code here...
].

Admittedly, this doesn't give you the traditional "replace: source with: dest"
syntax, but it does avoid having to invent anything too alien.

Also, I will point out that Smalltalk is not, traditionally, a decent
scripting language. The syntax is designed for small chunks of code floating
in a huge sea of an image and doesn't lend itself well to serialising (hence
this discussion). So you may find it clearer to invent an entirely new syntax
for reading in big chunks of code, that's not based on reading and executing
single statements. How about something along the lines of:

String
- join: aCollectionOfStrings
        ...code here...

- replace: source with: dest
        ...code here...

Indented lines are the code body, a line by itself specifies a class, lines
beginning with - define a method, lines beginning with + define a class 
method...

-- 
+- David Given --McQ-+ "Gaping from its single obling socket was
|  address@hidden    | scintillating, many fauceted scarlet emerald..."
| (address@hidden) | --- Jim Theis, _The Eye of Argon_ (spelling
+- www.cowlark.com --+ original)


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]