On Mon, Feb 9, 2015 at 12:31 PM, stepharo <[email protected]> wrote:

> Hi
>
> today during a lecture I was quite surprised to see the name of the AST
> variables.
> There is no easy way to see that a variable is a position in the text or a
> subtree.
>
> Example
>
> RBValueNode subclass: #RBArrayNode
>     instanceVariableNames: 'left right statements periods'
>     classVariableNames: ''
>     category: 'AST-Core-Nodes'
>
> RBValueNode subclass: #RBBlockNode
>     instanceVariableNames: 'left right colons arguments bar body scope'
>     classVariableNames: ''
>     category: 'AST-Core-Nodes'
>
> Annoying because you have always to think (yes I know I'm stupid not
> knowing by heart the tree structure)
> to know if you get a tree under your fingers. We can definitively better
> in terms of code habilitability.
> We cleaned the visitor and since then the code is much much much better.
>
>
> I would do the following
>
> RBValueNode subclass: #RBArrayNode
>     instanceVariableNames: 'leftParenthesisPosition
> rightParenthesisPosition statements periodsPosition'
>     classVariableNames: ''
>     category: 'AST-Core-Nodes'
>

 leftParenthesisIndex is shorter... leftParenIndex shorter still ;-)


I would be also ok with
>
> RBValueNode subclass: #RBArrayNode
>     instanceVariableNames: 'leftPosition rightPosition statements
> periodsPosition'
>     classVariableNames: ''
>     category: 'AST-Core-Nodes'
>
> RBValueNode subclass: #RBBlockNode
>     instanceVariableNames: 'leftPosition rightPosition colonsPosition
> arguments barPosition body scope'
>     classVariableNames: ''
>     category: 'AST-Core-Nodes'
>
>


-- 
best,
Eliot

Reply via email to