[webkit-reviews] review granted: [Bug 211256] [JSC] intlBooleanOption should return Optional<bool> instead of taking an out param : [Attachment 398095] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Apr 30 15:02:25 PDT 2020
Darin Adler <darin at apple.com> has granted Ross Kirsling
<ross.kirsling at sony.com>'s request for review:
Bug 211256: [JSC] intlBooleanOption should return Optional<bool> instead of
taking an out param
https://bugs.webkit.org/show_bug.cgi?id=211256
Attachment 398095: Patch
https://bugs.webkit.org/attachment.cgi?id=398095&action=review
--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 398095
--> https://bugs.webkit.org/attachment.cgi?id=398095
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=398095&action=review
> Source/JavaScriptCore/ChangeLog:3
> + [JSC] intlBooleanOption should return Optional<bool> instead of
taking an out param
Sam Weinig has advised us to not use Optional<bool> because it’s too easy to
get wrong, with a subtle distinction between !x and !*x / !x.value() for
example. I am OK with it personally, though.
>> Source/JavaScriptCore/runtime/IntlCollator.cpp:182
>> + else {
>
> The spec does say to construct an empty object here, but since every option
will be undefined anyway, we technically could just keep a null JSObject*. Not
sure if there's a preferred style for this.
I think a nullptr for JSObject is better: less pressure on the garbage
collector, smaller code size. Would we have to add a lot of null checks?
Another option would be to use a pointer to a known empty object.
More information about the webkit-reviews
mailing list