-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename objc2::rc::Id
to objc2::rc::Retained
#617
Comments
The only issue with I'm not sure of a good alternative though. Maybe The You could also consider I could probably live with |
I'll admit that I've strayed away from using If it were named I don't hate Throwing out some other (possibly bad) names:
At first I thought that Through the course of writing pros-cons and research, I've convinced myself that I like |
Thanks for the input both of you, it's really valuable having someone to spar with! I think the rough conclusion (if any can be reached) is to go with
After #563 it will just be Objectice-C's |
`Id` is a soft-deprecated to `Retained`, that name better reflects what it actually represents. See also madsmtm/objc2#617.
Id<T>
is a leftover fromobjc_id
, but that name doesn't actually convey any meaning to an outsider, and has only weak relevance to the concept in Objective-C (it somewhat matchesid
, but that's actually closer toAnyObject
). Additionally, the shorthand "ID" is usually used to refer to an "Identity Document" or an "Identifier", both of which this most definitely is not.Instead, we should use the name
Retained<T>
, which more clearly communicates that it is a retained smart pointer. (The concept ofretain
/release
is one that I'd more expect previous and future Objective-C developers to understand).Alternative names:
Arc<T>
, would match well with the ARC i.e. Automatic Reference Counting concept in Objective-C, but conflicts withstd::sync::Arc
. Still, it's whatfruity
does.R<T>
as a shorthand. Also whatcidre
does.Strong<T>
.Object<T>
.ArcObject<T>
Migration plan:
objc2 v0.5.2
: IntroduceRetained<T>
as an alias ofId<T>
. EDIT: Done in b8adc2b.Retained<T>
instead ofId<T>
. EDIT: Done in d097cd2.objc2 v0.6.0
: Deprecate the nameId<T>
.Id<T>
(maybe never, the cost of keeping the alias is basically zero).This also affects:
WeakId<T>
, should be renamed toRetainedWeak<T>
? Or justobjc2::rc::Weak<T>
, just like we have bothstd::sync::Weak<T>
andstd::rc::Weak<T>
?msg_send_id!
/#[method_id(...))]
, I'm going to keep these names asid
is still a concept in Objective-C that refers to "an object", and calling them_retain
would be wrong (as whether or not to retain is). Maybe_object
or_
would be better, but it's not as glaring a problem.IsIdCloneable
, should be renamed toIsRetainedCloneable
? Or maybe don't do anything here, and instead wait for Consider removing (non-interior) mutability? #563.DefaultId
,IdFromIterator
andIdIntoIterator
should all be renamed.CC @simlay @silvanshade, I'm making this change far too late in the project's lifetime, but I believe it to be the right thing to do, even considering the maintenance cost to dependencies. Do you have alternative naming suggestions, or other opinions?
The text was updated successfully, but these errors were encountered: