[Pharo-dev] Smalltalk Syntax in a Postcard contest

Hernán Morales Durand hernan.morales at gmail.com
Tue Jul 8 20:27:39 EDT 2014


I forgot to add

each ast allChildren anySatisfy: [ : node | node isCascade ]

which in that case, there is no method in the Pharo 3 image. Maybe a
package out there...
Anyway, who can load all packages? :)

Hernán

PS: One problem with StackExchange is there are very few smalltalkers
registered.



2014-07-08 21:20 GMT-03:00 Hernán Morales Durand <hernan.morales at gmail.com>:

> Hello Martin,
>
> I have refined the search a little bit, and we have a new winner with
> Stephane Ducasse as author in annotations.
>
> PSMCMergeMorph>>model: aMerger
>     "Set the model and update the window."
>
>     |grouped sorted|
>     super model: aMerger.
>     grouped := aMerger operations
>         groupBy: [:o | o targetClassName ifNil: [o shortSummary]]
>         having: [:g | true].
>     sorted := OrderedCollection new.
>     grouped keys asSortedCollection do: [:k |
>         sorted addAll: ((grouped at: k) asSortedCollection: [:a :b | a
> shortSummary <= b shortSummary])].
>     self patchMorph model: sorted
>
> This is the code I have used:
>
> | allMethods |
> allMethods := SystemNavigation default allMethods.
> UIManager default displayProgress: 'Scanning all methods...'
>     from: 1
>     to: allMethods size
>     during: [ : bar | | current |
>         current := 0.
>         allMethods select: [ : each |
>             current := current + 1.
>             bar value: current.
>             each ast arguments notEmpty and: [
>             (each ast allChildren anySatisfy: #isAssignment) and: [
>             (each ast allChildren anySatisfy: #isBlock) and: [
>             each ast temporaries notEmpty and: [
>             each ast superMessages notEmpty and: [
>             (each ast allChildren anySatisfy: [ : node | node isMessage
> and: [ node selector isUnary ] ]) and: [
>             (each ast allChildren anySatisfy: [ : node | node isMessage
> and: [ node selector isBinary ] ]) and: [
>             (each ast allChildren anySatisfy: [ : node | node isBlock and:
> [ node arguments size = 2] ]) and: [
>             (each ast allChildren anySatisfy: [ : node | node isBlock and:
> [ node arguments size = 1] ])
>                 ] ] ] ] ] ] ] ] ] ].
>
> Cheers,
>
> Hernán
>
>
>
> 2014-07-08 18:48 GMT-03:00 MartinW <wm at fastmail.fm>:
>
> I removed the question, but only after it was already marked to be closed
>> by
>> several people. Their argument was, that the question was "to broad".
>> Once a
>> discussion like this starts on Stackexchange sites there's always a herd
>> behavior that's hard to stop.
>>
>> Can you share the code you used for your search, Hernán?
>>
>>
>> Hernán Morales Durand wrote
>> > The contest is gone?
>> >
>> > Anyway, the closest useful method I have found by iterating all ASTs in
>> > standard 3.0 image :
>> >
>> > - Declares arguments
>> > - Has assignment
>> > - Has sequence
>> > - Has blocks with 0 and 2 arguments
>> > - Declares temporaries
>> > - Has binary messages
>> > - Has unary messages
>> > - Has keyword messages
>> > - Has super messages
>> > - Has cascade
>> > - Has return
>> > - Uses String and Integer
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Smalltalk-Syntax-in-a-Postcard-contest-tp4766793p4767121.html
>> Sent from the Pharo Smalltalk Developers mailing list archive at
>> Nabble.com.
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140708/7ade70ff/attachment-0002.html>


More information about the Pharo-dev mailing list