in reply to Re^2: Parse::RecDescent autotree visitor
in thread Parse::RecDescent autotree visitor

The built-in OO system in perl is really a basic set to object-orientation. It works quite well and if you want more distance to the nitty-gritty it allows you to build modules to get inside-out objects or have a more refined OO with Moose for example. So it isn't uncommon that OO features of the system are used for any purpose that fits.

Naturally I can't look in the mind of Damian Conway, but I would guess that he just used the bless to store an attribute (the name of the token) so that the hash doesn't need a special key for it. While I'm sure he knows patterns I would guess that designing for or avoiding this pattern was not his intention. It was just a good use for objects and bless.

And no to your second question, a loop in the parse tree would be a bug.

  • Comment on Re^3: Parse::RecDescent autotree visitor