WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
143388
is* API methods should be @properties
https://bugs.webkit.org/show_bug.cgi?id=143388
Summary
is* API methods should be @properties
Geoffrey Garen
Reported
2015-04-03 14:54:12 PDT
is* API methods should be @properties
Attachments
Patch
(13.82 KB, patch)
2015-04-03 14:55 PDT
,
Geoffrey Garen
mark.lam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Geoffrey Garen
Comment 1
2015-04-03 14:55:34 PDT
Created
attachment 250100
[details]
Patch
Mark Lam
Comment 2
2015-04-03 15:12:23 PDT
Comment on
attachment 250100
[details]
Patch r=me
Michael Saboff
Comment 3
2015-04-03 15:15:27 PDT
Comment on
attachment 250100
[details]
Patch What about code that use the old idioms? Isn't there a binary compatibility issue?
Geoffrey Garen
Comment 4
2015-04-03 15:18:37 PDT
> What about code that use the old idioms? Isn't there a binary compatibility > issue?
The Objective-C language generates method implementations for @property's, so old code that uses method invocation syntax still works.
Geoffrey Garen
Comment 5
2015-04-03 15:18:54 PDT
Committed
r182336
: <
http://trac.webkit.org/changeset/182336
>
Joseph Pecoraro
Comment 6
2015-04-04 10:55:59 PDT
Comment on
attachment 250100
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=250100&action=review
> Source/JavaScriptCore/API/JSValue.h:383 > -- (BOOL)isUndefined; > +@property (readonly) BOOL isUndefined;
I think ObjC convention would be to not include "is" in the property name, but specify it in the getter, like:
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#//apple_ref/doc/uid/TP40011210-CH5-SW1
@property (readonly, getter=isUndefined) undefined; That said, I'm not sure if these are exceptional cases because of their names.
Geoffrey Garen
Comment 7
2015-04-06 11:05:30 PDT
> I think ObjC convention would be to not include "is" in the property name, > but specify it in the getter, like: >
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/
> ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html#// > apple_ref/doc/uid/TP40011210-CH5-SW1
Yes, that is often true of properties.
> @property (readonly, getter=isUndefined) undefined; > > That said, I'm not sure if these are exceptional cases because of their > names.
The consensus among some experts was that these properties were special because a property like "object.array" (as opposed to "object.isArray") might be expected to produce or consume an array, which is not what these properties do.
Joseph Pecoraro
Comment 8
2015-04-06 12:17:33 PDT
> > @property (readonly, getter=isUndefined) undefined; > > > > That said, I'm not sure if these are exceptional cases because of their > > names. > > The consensus among some experts was that these properties were special > because a property like "object.array" (as opposed to "object.isArray") > might be expected to produce or consume an array, which is not what these > properties do.
The "object.array" would not have existed, it still produces "object.isArray". That said, since it is readonly, I think what you have reads better anyways. In the end it all amounts to the same thing =)
Geoffrey Garen
Comment 9
2015-04-06 13:36:35 PDT
> The "object.array" would not have existed, it still produces > "object.isArray".
Hmmm... not even in Swift?
Joseph Pecoraro
Comment 10
2015-04-07 10:46:00 PDT
(In reply to
comment #9
)
> > The "object.array" would not have existed, it still produces > > "object.isArray". > > Hmmm... not even in Swift?
Good point, I didn't think about Swift! I assumed it would respect "getter=" but after looking at some examples online, it looks like it doesn't.
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