> On Nov 3, 2016, at 9:00 AM, stepharo <[email protected]> wrote:
> 
> Because like that
> 
>    we have a correct and nice hierarchy and
> 
>    all the nodes inherits from it and
> 
>    we can have a nice visitor and make assumption about the root.
> 
> Regularity is nice and it helps controlling complexity.
> 
> Why a comment could not have a parent?

A comment isn’t code. The nodes are for code. A comment is more like a token — 
RBComment basically has the same two instance variables as RBToken. Should 
tokens also be nodes? For example, should a left paren token be represented as 
a node? 

If a comment is a node, how is it visited? For example, if you have (“comment1” 
self “comment2” foo: “comment3” a bar: “comment4” b “comment5”), what is the 
traversal order for the nodes? Furthermore, if comments are nodes, how do they 
affect all of the code rewriting and validation that is part of the RB and its 
rewrite tools?


John Brant

Reply via email to