<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        -1 for supporting [:arg ]<div><br><div>+1 for promoting [:arg | "nothing" ]</div><div>+1 for supporting [ "nothing" ] using #cull:</div></div><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 19.08.2019 23:35:56 schrieb Levente Uzonyi <leves@caesar.elte.hu>:</p><div style="font-family:Arial,Helvetica,sans-serif">On Mon, 19 Aug 2019, Nicolas Cellier wrote: <br> <br>>  <br>>  <br>> Le lun. 19 août 2019 à 03:37, John Pfersich via Squeak-dev <squeak-dev@lists.squeakfoundation.org> a écrit : <br>>       The full definition from the draft standards (don’t have the standard handy) is: <br>> <block constructor=""> ::= '[' <block body=""> ']' <br>> <block body=""> ::= [<block argument="">* '|'] [<temporaries>] [<statements>] <br>> <block argument=""> ::= ':' identifier <br>>  <br>> The last line is on the next page of the draft. <br>>  <br>> /————————————————————/For encrypted mail use jgpfersich@protonmail.comGet a free account at ProtonMail.com <br>> Web: www.objectnets.net and www.objectnets.org <br>>  <br>> On Aug 18, 2019, at 12:09, JOHN SARKELA via Squeak-dev <squeak-dev@lists.squeakfoundation.org> wrote: <br>> <br>>       The ANSI standard has the following rules for blocks: <br>> <br>>       <block constructor=""> ::= '[' <block body=""> ']' <br>>       <block body=""> ::= [<block argument="">* '|'] [<temporaries>] [<statements>] <br>>  <br>> The standard does not recognize [:x] as legal syntax for a block.<page21image64736448.png> <page21image37471328.png> <page21image64735680.png> <page21image64733952.png> <page21image64746816.png> <br>>  <br>> Yes, same as blue book. (block temporaries apart, this did not exist in st-80), bar is mandatory. <br>>                   On Aug 18, 2019, at 3:03 PM, Levente Uzonyi <leves@caesar.elte.hu> wrote: <br>>  <br>> Hi Nicolas, <br>>  <br>> Thanks for investigating this. <br>>  <br>> It's been a pretext for playing with historical material ;) <br>> <br>>                   I still think that it's just a parser bug, which is accidentally "used" sometimes, especially because it only works when the block is empty. <br>>  <br>> Seeing the code, it's the & (hereType ~~ #rightBracket) condition following (t1 size > 0 which makes [:x ] syntax possible. <br>> Since it has been added explicitely, my bet is that it has been added purposely and deliberataly rather than accidentally. <br>>  <br>> It seems [:x ] was not accepted in earlier version 00: <br>>  <br>> [block | blk argNodes argument | <br>>   " '[' {:var.} (:var|statements) ']'   BlockNode" <br>>  argNodes ← (Vector new: 1) asStream. <br>>  (self match: #leftBracket) <br>>    ifTrue: <br>>          [[(self match: #colon) and: [((argument ← self match: #word) <br>>            ifTrue: [argNodes next← encoder autoBind: argument] <br>>            ifFalse: [↑self expected: 'Argument name'])]] whileTrueDo: []. <br>>          (argNodes empty or: [(self match: #verticalBar)])   false <br>>            ifTrue: [↑self expected: 'Vertical bar']. <br>>          ((blk ← self statements: argNodes contents doit: false) and: [(self match: #rightBracket)]) <br>>            ifTrue: [↑blk]. <br>>          ↑self expected: 'Period or right bracket'] <br>>    ifFalse: [↑self expected: 'Left bracket']]. <br>> http://xeroxalto.computerhistory.org/Indigo/BasicDisks/Smalltalk14.bfs!1_/.st80sources.v00.html <br>> <br>>                   Or does it work in other dialects with non-empty blocks? <br>>  <br>>  <br>> Nope, the syntax is only for empty blocks. <br>> It could have worked for any block if we wanted to, because that vertical bar is just a decoration in blocks. <br>> From disambiguation POV, it's absolutely unecessary, the block arguments are already delimited by colon prefix :x <br>> Symetrically, we don't use such delimitation between method pattern and statements... But it evolved across history: <br>>  <br>> Historically, Smalltalk-76 did use a single (optional) bar for declaring temporaries (if any): <br>> methodDefnition := pattern [ '|' temporaries ] '[' statements ']' <br>>  <br>> Then early Smalltalk-80 method definitions did use empty temps systematically '[' pattern '|' '|' statements ']' <br>> The two bars were mandatory at that time <br>>  <br>> "374" LADParser$'Parser' <br>> [temporaries | vars | <br>>   "[ '|' {variable} ]   {variable, ..., variable}" <br>>  (self match: #verticalBar) and: [((self match: #verticalBar) <br>>    ifTrue: [↑#()]. <br>>  vars ← (Vector new: 8) asStream. <br>>  [hereType   #word] whileTrueDo: [vars next← encoder bind: self advance]. <br>>  (self match: #verticalBar) <br>>    ifTrue: [↑vars contents])]. <br>>  ↑self expected: 'Vertical bar']. <br>> http://xeroxalto.computerhistory.org/Indigo/BasicDisks/Smalltalk14.bfs!1_/.st80sources.v00.html <br>>  <br>> I guess that current block syntax is the legacy from all these syntax evolutions/experiments... <br>>  <br>> Personnally, I like the bar, because it reminds me mathematical notation I learned at school for ensemble comprehension https://fr.wikipedia.org/wiki/Ensemble... <br>>  <br>>      {x ∊ E | x even } <br>>  <br>> translated in Smalltalk: <br>>  <br>>     E select: [:x | x even]. <br>>  <br>> without bar, I'm really NOT used to it: <br>>     E select: [:x x even]. <br>>  <br>> <br>>                   Is it used in other dialects? <br>>  <br>> It is used in Squeak: <br>>  <br>> Context>>runSimulated: aBlock <br>>      "Simulate the execution of the argument, current. Answer the result it <br>>     returns." <br>>  <br>>      ^ thisContext sender <br>>      runSimulated: aBlock <br>>      contextAtEachStep: [:ignored] <br>>  <br>>      "Context runSimulated: [Pen new defaultNib: 5; go: 100]" <br>>  <br>> See also MCMcdReader>>#loadPatch MCPatch>>#initializeWithBase:target: <br> <br>There are 24 uses in my image, one from an external package: Xtreams: <br> <br>CurrentReadOnlySourceFiles cacheDuring: [ <br>      | regex | <br>      regex := '\[\s*\:\s*\w+\s*\]' asRegex. <br>      SystemNavigation default browseAllSelect: [ :method | <br>              regex search: method getSource asString ] ] <br> <br> <br>>  <br>> I also see two usages in VW, MethodContext>>#selector and BlockContext>>#selector. <br>> The fact that these two methods still have undescore (left arrow) assignment in source code and have same argument signature [:ignored] speaks for itself!!! <br>> I'm convinced that it's been an easy hack/feature originating in early 80s (probably by Dan Ingalls), and forgotten since, that never made it into the offical specifications. <br>> Smalltalk is malleable enough :) <br>>  <br>> We can deprecate it if we want, but we will have to support backward compatibility in the Parser. The boring side of frozen specs... <br>> In this case,we'd better not support it in Shout. <br> <br>Most users just ignore the argument of an error handler block this way,  <br>but that's unnecessary in Squeak, because the block doesn't have to have  <br>any arguments: <br> <br>      [ self error ] on: Error do: [ "nothing" ] <br> <br>But some users can't omit the block argument so easily, so perhaps its  <br>worth supporting this construct in Shout. <br> <br>Levente <br> <br>> <br>>                   Levente <br>> <br>>                   On Sun, 18 Aug 2019, Nicolas Cellier wrote: <br>> <br>>                         Le jeu. 15 août 2019 à 12:21, Levente Uzonyi <leves@caesar.elte.hu> a écrit : <br>>                              On Thu, 15 Aug 2019, Tobias Pape wrote: <br>> <br>>                              > <br>>                              >> On 15.08.2019, at 03:29, Levente Uzonyi <leves@caesar.elte.hu> wrote: <br>>                              >> <br>>                              >> On Wed, 14 Aug 2019, commits@source.squeak.org wrote: <br>>                              >> <br>>                              >>> A new version of ShoutCore was added to project The Inbox: <br>>                              >>> http://source.squeak.org/inbox/ShoutCore-ct.69.mcz <br>>                              >>> <br>>                              >>> ==================== Summary ==================== <br>>                              >>> <br>>                              >>> Name: ShoutCore-ct.69 <br>>                              >>> Author: ct <br>>                              >>> Time: 14 August 2019, 10:43:04.7164 pm <br>>                              >>> UUID: 7d165f4e-09bf-a445-a664-5e8edb9867b8 <br>>                              >>> Ancestors: ShoutCore-ul.68 <br>>                              >>> <br>>                              >>> Fix bug in SHParserST80: Wrong styling after blocks with arguments without statements <br>>                              >> <br>>                              >> 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. <br>>                              >> The vertical bar, even though I consider it unnecessary in all cases, is mandatory when there are arguments. <br>>                              > <br>>                              > 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 <br>>                         is a syntax idiosyncrasy that is in active use, not only "old code". <br>>                              > <br>>                              > Either we forbid it in the parser and change all of the image or allow it in Shout. <br>> <br>>                              Can you give me examples? <br>>                              I suspect those are just typos, which the parser accidentally accepted <br>>                              (and Shout as well before my fixes). <br>> <br>>                              Levente <br>>                         I don't remember seeing this syntax before and found it a bit surprising. <br>>                         So, for the sake of curiosity, I tried in some other dialects. <br>>                         [:x ] is accepted syntax in <br>>                         - Visualworks (8.3), <br>>                         - Pharo (v7 with OpalCompiler) <br>>                         - Smalltalk-80 (apple v0.?) <br>>                         [:x ] is invalid in <br>>                         - Dolphin <br>>                         - Smalltalk/X (jv branch) <br>>                         So it seems that it's something originating from original Smalltalk-80, but not reproducted in non derivated dialects... <br>>                         The bar is mandatory in blue book specification (see the last pages) <br>>                         Capture d’écran 2019-08-18 à 17.11.53.png <br>>                         So it seems that implementation did not agree with specifications for ages... <br>>                         Capture d’écran 2019-08-18 à 18.56.05.png <br>> <br>>                              > <br>>                              > Best regards <br>>                              >       -Tobias <br>>                              > <br>>                              >> <br>>                              >> Levente <br>>                              >> <br>>                              >>> <br>>                              >>> Thanks Jakob for the report! <br>>                              >>> <br>>                              >>> =============== Diff against ShoutCore-ul.68 =============== <br>>                              >>> <br>>                              >>> Item was changed: <br>>                              >>> ----- Method: SHParserST80>>parseBlockArguments (in category 'parse') ----- <br>>                              >>> parseBlockArguments <br>>                              >>> <br>>                              >>>     currentTokenFirst == $: ifFalse: [ ^self ]. <br>>                              >>>     [ currentTokenFirst == $: ] whileTrue: [ <br>>                              >>>             self <br>>                              >>>                     scanPast: #blockArgColon; <br>>                              >>>                     parseArgument: #blockPatternArg ]. <br>>                              >>> +   ((self parseVerticalBarForTemporaries: #blockArgsBar) and: [ <br>>                              >>> +           currentTokenFirst ~= $] ]) <br>>                              >>> +                   ifFalse: [ <br>>                              >>> +                           self fail ": Missing block args bar" ]! <br>>                              >>> -   (self parseVerticalBarForTemporaries: #blockArgsBar) ifFalse: [ <br>>                              >>> -           self fail ": Missing block args bar" ]! <br>>                              >> <br>>  <br>>  <br>>  <br>>  <br>>  <br>><br></leves@caesar.elte.hu></leves@caesar.elte.hu></leves@caesar.elte.hu></page21image64746816.png></page21image64733952.png></page21image64735680.png></page21image37471328.png></page21image64736448.png></statements></temporaries></block></block></block></block></squeak-dev@lists.squeakfoundation.org></block></statements></temporaries></block></block></block></block></squeak-dev@lists.squeakfoundation.org></div></blockquote>
                                        </div></body>