Paolo Bonzini wrote:

No argument with anything you said, except:

- ^self inject: aCollectionOfStrings into: [ :a : b | a, b ]
+ ^aCollectionOfStrings fold: [ :a : b | a, self, b ]

was what I meant :-) (like perl's join).

>> I don't think that the #methodsFor: case works so well. There's less
>> justification for having a special-case block:
>>   
> 
> The justification is just to provide a familiar syntax to people that
> have prejudice. :-)  If the mountain does not go to Mohammed, ...

Well, yes, but with the method body it makes some kind of sense, because
the [] enclose valid code. It grates a bit more for the methodsFor: case
is all. Would you separate the method declarations with periods?

Your quotation is backwards, by the way  (-:

>> Personally, I wouldn't mind declaring the category for each method:
>>
>> String methodFor: 'examples' body: [ join: aCollectionOfStrings
>>     "Join the elements of aCollectionOfStrings, in order, with myself."
>> ]
>>   
> 
> Yes, and that's about the same as the above "Method" syntax.  I don't
> have a "body:" because anyway this has to be special cased in the parser
> -- it's not a block anyway, it's just reusing the [ ] tokens, the same
> as { } are used for scoping many different things in C/C++/Java.

A method declaration is *very* similar to a block, though. For a list of
methods, it would make more sense (to me at least) to re-use {}.

Anyway, these are minor niggles.

I don't think it's wise to point to C/C++ as good examples BTW ;-)

Mike


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to