[webkit-dev] the name "AtomicString"
Maciej Stachowiak
mjs at apple.com
Thu Dec 20 02:37:39 PST 2018
> On Dec 19, 2018, at 9:41 PM, Chris Dumez <cdumez at apple.com> wrote:
>
>>
>> On Dec 19, 2018, at 9:17 PM, Maciej Stachowiak <mjs at apple.com <mailto:mjs at apple.com>> wrote:
>>
>>
>>
>>> On Dec 19, 2018, at 8:06 PM, Ryosuke Niwa <rniwa at webkit.org <mailto:rniwa at webkit.org>> wrote:
>>>
>>> On Wed, Dec 19, 2018 at 1:13 PM Simon Fraser <simon.fraser at apple.com <mailto:simon.fraser at apple.com>> wrote:
>>> > On Dec 19, 2018, at 12:33 PM, Michael Catanzaro <mcatanzaro at igalia.com <mailto:mcatanzaro at igalia.com>> wrote:
>>> >
>>> > On Tue, Dec 18, 2018 at 9:31 PM, Darin Adler <darin at apple.com <mailto:darin at apple.com>> wrote:
>>> >> I’ve gotten used to the name AtomicString over the years, but I wouldn’t strongly object to changing it if other programmers are often confused by it’s similarity to the term “atomic operations”.
>>> >
>>> > Well there were two other developers in the thread Ryosuke linked to who made the exact same mistake as me, so I do think the current name is problematic. A change wouldn't need to be drastic, though. I think suggestions from the old thread like "StringAtom" or "AtomString" would be unproblematic. The problem is the specific word "atomic" carries an expectation that the object be safe to access concurrently across threads without locks; I think that expectation doesn't exist if not for the "ic" at the end.
>>> >
>>> > FWIW I've only ever heard the "interned string" terminology prior to now.
>>>
>>> SingletonString?
>>> UniquedString?
>>>
>>> I do like UniquedString. That conveys what AtomicString really is. SingletonString isn't so great since AtomicString table is still per thread.
>>
>> So hard to pronounce though! Why not UniqueString? It’s not quite as explicit but close enough.
>
> Wouldn’t it be confusing to use UniqueString type for a string that is *common* in order to save memory?
I would interpret it as UniqueString(foo) means “give me the unique copy of string foo”. You use a unique copy so you can use the same string in many places without wasting memory, or excess time on string compares. It’s used in many places, but there is only one. (Maybe we should call it HighlanderString? OK, not serious.)
>
> Personally, I like the AtomString proposal as it is close to the naming we are used to and addresses the issue raised (atomic has a different meaning with threading).
> Also, I had never heard of interned strings before.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20181220/9c90a8db/attachment.html>
More information about the webkit-dev
mailing list