For reference, the GNU Smalltalk specification does not allow this kind of expression ([:x]). Personally, I would find the syntax clear & unique, but when developing a solution for multiple Smalltalk dialects, this might be a disadvantage.
Maybe introduce a preference similar to #allowUnderscoreAsAssignment? Or would this make the things unnecessarily complex?
Best,
Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Tobias Pape Das.Linux@gmx.de Gesendet: Donnerstag, 15. August 2019 08:11:30 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] The Inbox: ShoutCore-ct.69.mcz
On 15.08.2019, at 03:29, Levente Uzonyi leves@caesar.elte.hu wrote:
On Wed, 14 Aug 2019, commits@source.squeak.org wrote:
A new version of ShoutCore was added to project The Inbox: http://source.squeak.org/inbox/ShoutCore-ct.69.mcz
==================== Summary ====================
Name: ShoutCore-ct.69 Author: ct Time: 14 August 2019, 10:43:04.7164 pm UUID: 7d165f4e-09bf-a445-a664-5e8edb9867b8 Ancestors: ShoutCore-ul.68
Fix bug in SHParserST80: Wrong styling after blocks with arguments without statements
If you mean that Shout should accept [ :x ], then no, I'm pretty sure that's not valid smalltalk syntax, even if Parser accepts it. The vertical bar, even though I consider it unnecessary in all cases, is mandatory when there are arguments.
I only got to know this "shortcut syntax" because eliot used it either Cog or somewhere in trunk when preparing something (Spur? full block closures? I forgot). So this is a syntax idiosyncrasy that is in active use, not only "old code".
Either we forbid it in the parser and change all of the image or allow it in Shout.
Best regards -Tobias
Levente
Thanks Jakob for the report!
=============== Diff against ShoutCore-ul.68 ===============
Item was changed: ----- Method: SHParserST80>>parseBlockArguments (in category 'parse') ----- parseBlockArguments
currentTokenFirst == $: ifFalse: [ ^self ]. [ currentTokenFirst == $: ] whileTrue: [ self scanPast: #blockArgColon; parseArgument: #blockPatternArg ].
((self parseVerticalBarForTemporaries: #blockArgsBar) and: [
currentTokenFirst ~= $] ])
ifFalse: [
self fail ": Missing block args bar" ]!
(self parseVerticalBarForTemporaries: #blockArgsBar) ifFalse: [
self fail ": Missing block args bar" ]!