Rename js::StringBuffer
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox131 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(4 files)
We're now using both js::StringBuffer
and mozilla::StringBuffer
in SpiderMonkey and it's a little confusing.
The name StringBuffer
probably applies better to the MFBT class and we could rename js::StringBuffer
to js::StringBuilder
or something.
Comment 1•6 months ago
|
||
Heh.
js::StringBuilder
would conflict less, but note that we already have js::JSONFullParseHandler::StringBuilder
, js::JSONSyntaxParseHandler::StringBuilder
, and js::JSStringBuilder
already. That last one also happens to be a subclass of js::StringBuffer
, and I don't think we want class JSStringBuilder : public StringBuilder
!
Probably we have at least one too many of these related things. It looks like nbp would put Sprinter
in this set as well.
(And I won't mention namespace { class StringBuilder }
— a StringBuilder
in an anonymous namespace in nsContentUtils.cpp
.)
Assignee | ||
Comment 2•6 months ago
|
||
(In reply to Steve Fink [:sfink] [:s:] from comment #1)
That last one also happens to be a subclass of
js::StringBuffer
, and I don't think we wantclass JSStringBuilder : public StringBuilder
!
I was thinking of that as a feature: "build a string" vs "build a JSString", but true, it could also be a bit confusing.
Comment 3•6 months ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #2)
(In reply to Steve Fink [:sfink] [:s:] from comment #1)
That last one also happens to be a subclass of
js::StringBuffer
, and I don't think we wantclass JSStringBuilder : public StringBuilder
!I was thinking of that as a feature: "build a string" vs "build a JSString", but true, it could also be a bit confusing.
Oh darn, I totally missed that. I was reading JSStringBuilder
as JS_StringBuilder
, not JSString_Builder
. Thinking of it as the latter... you're right, that's kind of nice!
Comment 4•6 months ago
|
||
I will note that Sprinter
also has a JSprinter
variant which provide the correct allocation buffer for the string.
While Sprinter is restricted to error messages and debugging, it does serve the same goal of building a string.
Updated•6 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
Assignee | ||
Comment 5•5 months ago
|
||
We now also use mozilla::StringBuffer
in SpiderMonkey so this is less confusing.
There is already a JSStringBuilder
class that inherits from StringBuilder
so it's also a little more consistent.
Updated•5 months ago
|
Assignee | ||
Comment 6•5 months ago
|
||
Assignee | ||
Comment 7•5 months ago
|
||
Assignee | ||
Comment 8•5 months ago
|
||
Comment 10•5 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b2178f64ae9e
https://hg.mozilla.org/mozilla-central/rev/f953b35772bd
https://hg.mozilla.org/mozilla-central/rev/d03272a851c4
https://hg.mozilla.org/mozilla-central/rev/9850752a3b55
Description
•