String vs. StringBuilder vs. Deparser usage #1292
manticore-projects
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
Point one is somehow grown. Nowadays a StringBuilder is not needed anymore since internally string concatenation is transformed to a StringBuilder construct. Point two: I still stick to #133 (b). But you are right, they should produce the same output. So problems with both implementations are generating different outputs should be resolved, but I prefer both ways to be alive. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Concern a) toString() vs. StringBuilder has been solved via PR #1301. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Greetings!
At the moment, I feel like the whole implementation of the DeParsing stuff is not optimal:
there are countless String to StringBuilder and StringBuilder to String conversions
the toString() methods compete with the DeParser implementations. In the best case they are completely redundant and do the same. In the worst case they produce different output.
Suggestions:
a) maybe we would like to make
Statement
abstract and introduce an additional abstract methodI have actually used that for all recent statements i have added and I am just looking for a formalized design pattern, which we should also mention in the "How to contribute" documentation.
b) Can we somehow remove the Duplication between toString() and the DeParser implementation?
I feel like the easiest way would be to call
appendTo(builder)
within the DeParser for each entity. This was cheap and simple.Alternatively, we would call the Deparser inside each
appendTo()
implementation of the Statements and Expressions. But that feels like 'overdesigned' to me and I can't see the benefit of going that route.Which way would you like to prefer or should we better not touch that stuff at all?
Again, I would like to agree on a kind of Design Pattern which is also stated in a "How to contribute" document.
Beta Was this translation helpful? Give feedback.
All reactions