Bug 199452

Summary: WebKit has too many ways to stringify things
Product: WebKit Reporter: Darin Adler <darin>
Component: Web Template FrameworkAssignee: Darin Adler <darin>
Status: ASSIGNED    
Severity: Normal CC: fpizlo, mitz, mrobinson, sam, simon.fraser
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 199782    
Bug Blocks:    

Darin Adler
Reported 2019-07-03 09:59:39 PDT
WebKit has too many different ways to stringify things. Here are the ones I have found so far: std::ostream WTF::makeString (part of WTF’s StringConcatenate) WTF::ValueToString
 WTF::LogArgument (part of WTF::Logger) WTF::PrintStream dump functions WTF::TextStream I plan to remove WTF::ValueToString first, changing the only client (POD trees) to use TextStream instead. I would welcome other ideas for how to get rid of this redundancy.
Attachments
Darin Adler
Comment 1 2019-07-08 19:03:13 PDT
WTF::StringBuilder
Darin Adler
Comment 2 2019-12-07 13:59:56 PST
Seems like we should remove PrintStream and replace it with TextStream. One way to do it is to make PrintStream use TextStream and then remove it a bit at a time.
Darin Adler
Comment 3 2020-01-04 11:52:21 PST
TextStream has some anomalies in how it serializes floating point numbers, always using fixed position with two decimal places.
Darin Adler
Comment 4 2020-03-31 13:02:41 PDT
We’ve made progress on unifying makeString and StringBuilder, by having StringBuilder::append be built on the same underpinnings as makeString!
Darin Adler
Comment 5 2020-03-31 13:03:37 PDT
In bug 199782 I deleted ValueToString. One down!
Simon Fraser (smfr)
Comment 6 2020-03-31 13:04:09 PDT
(In reply to Darin Adler from comment #3) > TextStream has some anomalies in how it serializes floating point numbers, > always using fixed position with two decimal places. We can control that with FormattingFlags (which itself should be an OptionSet<>).
Darin Adler
Comment 7 2020-03-31 13:06:06 PDT
Yes. I was focusing on the default behavior, not the customizability of it
Note You need to log in before you can comment on or make changes to this bug.