Thu, Jan 9, 2020 at 6:58 AM Brian Theado <brian.the...@gmail.com> wrote:

> I'm guessing this is a response only to my 2nd sentence and not both
sentences?

Correct.  But in this case the present code is better, imo.  I'm not
suggesting that we should prefer functions to classes generally.
Without a class, you would have to implement visit as a callback.

Isn't the purpose of 'visit' to be able to loop over the nodes?
>

The visit method visits the given node.  It's natural and good to have
subclasses visit nodes in subclass-specific ways.

At one extreme, the Fstringify class only cares about BinOp nodes, so
Fstringify.visit contains a single test.  At the other extreme, other
classes could dispatch on the type of node, as is done in Orange.beautify.

However, the Orange class doesn't need TOT.traverse, because tokens already
are in a specific order. As a result, the Orange class isn't a subclass of
TOT.

I'm happy with the TOT.traverse where it is.  You have little chance of
changing my mind. And my mind is elsewhere, as I'll soon explain in a new
post about using parse tree data in the Orange class.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS1sbpHdN-VbE4ZaOMq6HTeN2CS_Dut_QLO081STSX8TwA%40mail.gmail.com.

Reply via email to