Multiple pretty printing APIs? #3731
Replies: 1 comment 1 reply
-
|
The Java one is mostly for debugging, so I'm not particularly worried about that one. I think it would be fine for it to be improved/changed to match, but I'm not sure if @enebo or @eregon are necessarily interested. The C and Ruby ones cannot be shared. The C one is for when you're working with C structs, the Ruby ones are for when you're working with Ruby objects. By the time we've reified all of the C structs into Ruby, we can no longer use the C version since the Ruby objects do not go back into C. At the same time, we can't use the Ruby version from C because the C version is used by So, they're all serving different purposes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
By my count, there are 3:
pm_prettyprint()prism/templates/src/prettyprint.c.erb
Line 27 in 16e5efb
Prism::Node#inspectprism/templates/lib/prism/inspect_visitor.rb.erb
Line 4 in 16e5efb
org.prism.Nodes.Node.toString()prism/templates/java/org/prism/Nodes.java.erb
Line 334 in 16e5efb
They're similar, but have slightly different formatting. E.g. C uses a
+--instead of a fancy├──.Notably, Kevin rewrote the Ruby implementation to use a queue instead of recursion in #2732, but the C and Java implementation still use recursion.
Would it be better to standardize all pretty printing in the C layer, and expose that to Ruby and Java?
Beta Was this translation helpful? Give feedback.
All reactions