[squeak-dev] Side effect of script _ -> :=

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Side effect of script _ -> :=

laza
Just a note that whatever script is used to transform _ into := in the
trunk. It does not recognize comments as in

 analyseTempsWithin: scopeBlock "<BlockNode>"  rootNode: rootNode "<MethodNode>"
-       "N.B.  since assigment happens _after_ the value is evaluated
the value is sent the message _first_."
+       "N.B.  since assigment happens :=after:= the value is
evaluated the value is sent the message :=first:=."
       value analyseTempsWithin: scopeBlock rootNode: rootNode.
       variable beingAssignedToAnalyseTempsWithin: scopeBlock rootNode: rootNode

Alex

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Side effect of script _ -> :=

Bert Freudenberg

On 22.08.2009, at 21:49, Alexander Lazarević wrote:

> Just a note that whatever script is used to transform _ into := in the
> trunk. It does not recognize comments as in
>
> analyseTempsWithin: scopeBlock "<BlockNode>"  rootNode: rootNode  
> "<MethodNode>"
> -       "N.B.  since assigment happens _after_ the value is evaluated
> the value is sent the message _first_."
> +       "N.B.  since assigment happens :=after:= the value is
> evaluated the value is sent the message :=first:=."
>       value analyseTempsWithin: scopeBlock rootNode: rootNode.
>       variable beingAssignedToAnalyseTempsWithin: scopeBlock  
> rootNode: rootNode


It's a dumb text replacement, that just checks no literal $_ was in  
the method. An actual parser-based replacement would have been nice,  
but nobody worked on it.

As for the example above, the author should not have used underscores  
but should actually have made the words bold or italic.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Side effect of script _ -> :=

Lukas Renggli
> It's a dumb text replacement, that just checks no literal $_ was in the
> method. An actual parser-based replacement would have been nice, but nobody
> worked on it.

The refactoring browser can trivially do this, it does pretty print
the code afterwards though:

ParseTreeRewriter new
        replace: '`var _ ``@object' with: '`var := ``@object' when: [ :node |
                node position notNil
                        and: [ node methodNode sourceText notNil
                        and: [ (node methodNode sourceText at: node position ifAbsent: [ ])
= $_ ] ] ];
        yourself

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch