Live data from Hacker News

CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

developer.apple.com

71–80 of 188 posts

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#71

Winforms has some gems: DataGridViewColumnDividerDoubleClickEventArgs ListViewVirtualItemsSelectionRangeChangedEventHandler

There is also this classic:

https://github.com/mattl/opensource.apple.com/blob/88cbaab4a...

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#72
post #11

Well, there's CNLabelContactRelationYoungerCousinMothersSiblingsDaughterOrFathersSistersDaughter, which is two letters longer than CNLabelContactRelationElderCousinMothersSiblingsDaughterOrFathersSistersDaughter. https://developer.apple.com/documentation/contacts/cnlabelco... This is my favorite topic.

Ok, we changed to that from https://developer.apple.com/documentation/contacts/cnlabelco.... Thanks!

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#73

Earlier quoted context omitted.

And off by one errors

If only there were 1 based PLs.

Perl supports this. Optionally, on a per-file basis. Because it’s Perl.

https://perldoc.perl.org/perlvar.html#%24%5b

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#75

I'm grateful that Apple at least prefixed this. IIRC, between iOS 11 and 12, Apple added a Contact class somewhere within their standard set of frameworks. I was maintaining an app that used CoreData as a store and did not have prefixed Core Data entity names. And of course it had its own Contact class. Long story short, I started building against the newer SDK and the app started crashing in the most oblique way pos…

Apple recommends to use at least a three character prefix in your objective-c classes to avoid collisions.

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#76
post #75

I'm grateful that Apple at least prefixed this. IIRC, between iOS 11 and 12, Apple added a Contact class somewhere within their standard set of frameworks. I was maintaining an app that used CoreData as a store and did not have prefixed Core Data entity names. And of course it had its own Contact class. Long story short, I started building against the newer SDK and the app started crashing in the most oblique way pos…

Apple recommends to use at least a three character prefix in your objective-c classes to avoid collisions.

I am well-acquainted with Apple's recommendations. The codebase I inherited was not. Unfortunately, Apple's Core Data documentation is also not acquainted with Apple's recommendations: https://developer.apple.com/library/archive/documentation/Co...

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#78
post #60

At first glance this looked like a code smell, but after some reflection I can't think of a cleaner, more readable way to uniquely identify each possible relationship -- especially in a strongly-typed language with an IDE. Here's the full list: https://developer.apple.com/documentation/contacts/contacts_...

You need an intermediate representation (like a tree) rather than attempt to brute force every possible permutation up until some arbitrary point. Even if that weren't the case, it'd be better to give it a more obscure name or create some kind of naming system and then document it rather than demonstrate why self-documenting code can become self-defeating if taken to an extreme.

The issue of a tree is you could trivially create nonsensical relationships. An alternative would be some sort of nested attributes / tag set but even that's not excellent.

A second issue is, this is probably a localisation / cultural concern: below, yorwba notes that this relationship is a specific term in chinese kinship: https://en.wikipedia.org/wiki/Chinese_kinship#Common_extende....

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#79
post #6

表姐, in case you were wondering.

Looks like this constant should be parsed as: ElderCousin && (MothersSiblingsDaughter || FathersSistersDaughter)

Mother's Sibling's Daughter or Father's Sister's Daughter.

FYI, Mother's Sibling is 舅舅 (Mother's Brothers) or 姨 (Mother's Sisters), and Father's Sister is 姑姑.

Re: CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

#80
post #60

At first glance this looked like a code smell, but after some reflection I can't think of a cleaner, more readable way to uniquely identify each possible relationship -- especially in a strongly-typed language with an IDE. Here's the full list: https://developer.apple.com/documentation/contacts/contacts_...

You need an intermediate representation (like a tree) rather than attempt to brute force every possible permutation up until some arbitrary point. Even if that weren't the case, it'd be better to give it a more obscure name or create some kind of naming system and then document it rather than demonstrate why self-documenting code can become self-defeating if taken to an extreme.

And generate the list using metaprogramming at compile time.
Post reply on HN