WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
210610
Clean up VectorCocoa createNSArray overloads and add documentation for createNSArray taking a map function
https://bugs.webkit.org/show_bug.cgi?id=210610
Summary
Clean up VectorCocoa createNSArray overloads and add documentation for create...
Daniel Bates
Reported
2020-04-16 10:13:10 PDT
Clean up VectorCocoa createNSArray overloads and add documentation for createNSArray taking a map function.
Attachments
Patch
(3.48 KB, patch)
2020-04-16 10:17 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch
(3.48 KB, patch)
2020-04-16 10:18 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch
(4.09 KB, patch)
2020-04-16 10:25 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch
(4.42 KB, patch)
2020-04-16 10:36 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
To Land
(3.96 KB, patch)
2020-04-16 11:28 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Daniel Bates
Comment 1
2020-04-16 10:17:43 PDT
Created
attachment 396661
[details]
Patch
Daniel Bates
Comment 2
2020-04-16 10:18:41 PDT
Created
attachment 396662
[details]
Patch
Daniel Bates
Comment 3
2020-04-16 10:25:30 PDT
Created
attachment 396665
[details]
Patch
Daniel Bates
Comment 4
2020-04-16 10:32:00 PDT
Comment on
attachment 396665
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=396665&action=review
> Source/WTF/ChangeLog:8 > + Remove unncessary local variable. Rename "map" type in createNSArray function for clarity
unncessary => unnecessary
Daniel Bates
Comment 5
2020-04-16 10:32:00 PDT
Comment on
attachment 396665
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=396665&action=review
> Source/WTF/ChangeLog:8 > + Remove unncessary local variable. Rename "map" type in createNSArray function for clarity
unncessary => unnecessary
Daniel Bates
Comment 6
2020-04-16 10:36:08 PDT
Created
attachment 396667
[details]
Patch
Darin Adler
Comment 7
2020-04-16 11:07:47 PDT
Comment on
attachment 396667
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=396667&action=review
> Source/WTF/wtf/cocoa/VectorCocoa.h:56 > +// An overload that takes a map function and returns a NSArray whose elements are the > +// result of calling the map function on each vector element. Like the makeNSArrayElement > +// function, the map function can return either a RetainPtr<id> or an id if the value > +// is autoreleased. When the map function is makeNSArrayElement then this function > +// behaves identically to createNSArray function that does not take a map function.
I’m not thrilled with this comment. Here’s my cut: // This overload of createNSArray takes a function to map each vector element to an Objective-C object. // The map function has the same interface as the makeVectorElement function above, but can be any // function including a lambda, a function-like object, or Function<>. I’m sure you can do even better.
> Source/WTF/wtf/cocoa/VectorCocoa.h:83 > - constexpr const VectorElementType* typedNull = nullptr; > + constexpr VectorElementType* typedNull = nullptr;
Please don’t make this change. The const there is about the type of the pointed-to item. This const should not be removed. In some coding styles it would be written as "constexpr VectorElementType const *", in case that makes it clearer to you. If this was not a pointer type, then the change would make sense to me, removing a redundant const, but that’s based on a misunderstanding here.
Daniel Bates
Comment 8
2020-04-16 11:17:46 PDT
Comment on
attachment 396667
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=396667&action=review
>> Source/WTF/wtf/cocoa/VectorCocoa.h:56 >> +// behaves identically to createNSArray function that does not take a map function. > > I’m not thrilled with this comment. Here’s my cut: > > // This overload of createNSArray takes a function to map each vector element to an Objective-C object. > // The map function has the same interface as the makeVectorElement function above, but can be any > // function including a lambda, a function-like object, or Function<>. > > I’m sure you can do even better.
You're tempting me...I'll just take your cut.
>> Source/WTF/wtf/cocoa/VectorCocoa.h:83 >> + constexpr VectorElementType* typedNull = nullptr; > > Please don’t make this change. The const there is about the type of the pointed-to item. This const should not be removed. In some coding styles it would be written as "constexpr VectorElementType const *", in case that makes it clearer to you. If this was not a pointer type, then the change would make sense to me, removing a redundant const, but that’s based on a misunderstanding here.
You're right, I'm wrong. I misread the code.
Daniel Bates
Comment 9
2020-04-16 11:18:10 PDT
Thanks for the review, btw
Daniel Bates
Comment 10
2020-04-16 11:26:31 PDT
Comment on
attachment 396667
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=396667&action=review
>>> Source/WTF/wtf/cocoa/VectorCocoa.h:56 >>> +// behaves identically to createNSArray function that does not take a map function. >> >> I’m not thrilled with this comment. Here’s my cut: >> >> // This overload of createNSArray takes a function to map each vector element to an Objective-C object. >> // The map function has the same interface as the makeVectorElement function above, but can be any >> // function including a lambda, a function-like object, or Function<>. >> >> I’m sure you can do even better. > > You're tempting me...I'll just take your cut.
The same interface as makeVectorElement? The same interface as makeNSArrayElement
Daniel Bates
Comment 11
2020-04-16 11:28:51 PDT
Created
attachment 396675
[details]
To Land
Daniel Bates
Comment 12
2020-04-16 11:30:34 PDT
Comment on
attachment 396675
[details]
To Land Clearing flags on attachment: 396675 Committed
r260202
: <
https://trac.webkit.org/changeset/260202
>
Daniel Bates
Comment 13
2020-04-16 11:30:36 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14
2020-04-16 11:31:16 PDT
<
rdar://problem/61895756
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug