TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

CNLabelContactRelation​YoungerCousin​MothersSiblingsDaughter​OrFathersSistersDaughter

211 点作者 wonderfuly将近 6 年前

31 条评论

TimTheTinker将近 6 年前
At first glance this looked like a code smell, but after some reflection I can&#x27;t think of a cleaner, more readable way to uniquely identify each possible relationship -- especially in a strongly-typed language with an IDE.<p>Here&#x27;s the full list: <a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;contacts_constants" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;contacts_...</a>
评论 #20351885 未加载
评论 #20352076 未加载
评论 #20352615 未加载
评论 #20352473 未加载
评论 #20352256 未加载
评论 #20352192 未加载
评论 #20352765 未加载
评论 #20351851 未加载
TorKlingberg将近 6 年前
I can see why this is needed. English has very broad words for relatives like &quot;grandfather&quot; or &quot;aunt&quot;. Most languages have more specific words, especially Chinese where there are separate words for fathers or mothers side, older or younger and sibling or siblings spouse. You also often use these relation words rather than their names when referring to a relatives. If this code was in Chinese, they would all be short words.<p>English words like &quot;aunt&quot; cannot really be translated into Chinese. If you are translating a book you either try to figure out the exact relation from the context, or just pick one if it doesn&#x27;t matter. In someones address book you can&#x27;t do that.
评论 #20353072 未加载
评论 #20352776 未加载
评论 #20358339 未加载
评论 #20352595 未加载
评论 #20352762 未加载
评论 #20352613 未加载
mraison将近 6 年前
There’s also CNLabelContactRelationColleauge. Oops :)<p><a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelcontactrelationcolleauge" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelco...</a>
评论 #20355821 未加载
评论 #20352122 未加载
yorwba将近 6 年前
表姐, in case you were wondering.
评论 #20351667 未加载
评论 #20351623 未加载
评论 #20351656 未加载
评论 #20351607 未加载
评论 #20352074 未加载
评论 #20352385 未加载
sixdimensional将近 6 年前
“There are only two hard things in Computer Science: cache invalidation and naming things.” [1]<p>[1] <a href="https:&#x2F;&#x2F;martinfowler.com&#x2F;bliki&#x2F;TwoHardThings.html" rel="nofollow">https:&#x2F;&#x2F;martinfowler.com&#x2F;bliki&#x2F;TwoHardThings.html</a>
评论 #20351705 未加载
评论 #20353164 未加载
salgernon将近 6 年前
For a long time, the Carbon universal headers Included a plain, non-namespaced (c header) MacTypes.h which included:<p>enum { h = 0, v = 1 };<p>This could lead to very confusing compiler errors... it was there for compatibility with an anonymous pascalnunion that let you treat a pascal Rect as an anonymous array of two Point structures..
euske将近 6 年前
Well, there&#x27;s CNLabelContactRelationYoungerCousinMothersSiblingsDaughterOrFathersSistersDaughter, which is two letters longer than CNLabelContactRelationElderCousinMothersSiblingsDaughterOrFathersSistersDaughter.<p><a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelcontactrelationyoungercousinmotherssiblingsdaughterorfatherssistersdaughter" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;documentation&#x2F;contacts&#x2F;cnlabelco...</a><p>This is my favorite topic.
评论 #20352001 未加载
评论 #20351935 未加载
aaronbrethorst将近 6 年前
I&#x27;m grateful that Apple at least prefixed this. IIRC, between iOS 11 and 12, Apple added a <i>Contact</i> 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 <i>Contact</i> class.<p>Long story short, I started building against the newer SDK and the app started crashing in the most oblique way possible. Prefixing the entity and class name solved the problem, but I only stumbled on that through a combination of luck, intuition, and half a day of banging my head against a wall.
评论 #20352030 未加载
princekolt将近 6 年前
Why is everyone assuming this is about Chinese??? CN is the class prefix for the Contacts.framework library, like every other Apple API. For example:<p>CoreLocation: CL (CLLocation)<p>SpriteKit: SK (SKScene)<p>CloudKit: CK (CKRecord)<p>CoreVideo: CV (CVBuffer)<p>LocalAuthentication: LA (LAContext)<p>So on and so forth...
评论 #20353003 未加载
评论 #20352987 未加载
rntksi将近 6 年前
I spent 10 minutes laughing about this and the worst part is my wife asking why am I laughing and I <i>cannot</i> explain why
评论 #20342567 未加载
shaggyfrog将近 6 年前
NativLang did a video about kinship systems that is relevant here: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YOi2c2d3_Lk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YOi2c2d3_Lk</a>
zaroth将近 6 年前
Upvote for breaking HN CSS on mobile.
chj将近 6 年前
A good example of poor naming. Explained:<p>Your younger cousin sister, either from one of your mother&#x27;s brothers and sisters, or from one of your father&#x27;s sisters.<p>Or two characters in Chinese: 表妹(BiaoMei). If she is from one of your father&#x27;s brothers, she&#x27;s your 堂妹(TangMei). The latter is regarded as being closer because you share the same family name, but nowadays it just doesn&#x27;t matter any more.<p>Some of the other commenters think it&#x27;s 表姐. No matter who is right, you see, the long name bears no clear meaning even for Chinese.
评论 #20354940 未加载
dmix将近 6 年前
Can HN add wordbreaking css on mobile?<p>This breaks the width of the page on mobile.
评论 #20351588 未加载
eslaught将近 6 年前
Does this page have some sort of camel-case aware word breaking? As I resize the page I notice it always remains broken at a word boundary and never breaks inside a word.<p>Ok, I see it now: there are wbr tags between the words on the page. TIL.
aitchnyu将近 6 年前
Anybody care to introduce me to this? Why does it have to be father&#x27;s sister but mother&#x27;s sibling? And how does elder and younger cousins behave differently?
评论 #20352184 未加载
评论 #20352073 未加载
评论 #20352245 未加载
shubhamjain将近 6 年前
Java Swing took verbosity even further than that. I present to you a 92-character class name [1].<p>&gt; InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState<p>Thankfully, I think they fixed it in the newer version.<p>[1]: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;peterlawrey&#x2F;status&#x2F;577176384520384512" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;peterlawrey&#x2F;status&#x2F;577176384520384512</a>
api将近 6 年前
Needs CNFathersMothersNephewsCousinsFormerRoommate
评论 #20352594 未加载
评论 #20351537 未加载
Waterluvian将近 6 年前
Is this just one of those exceptional cases when having a strict variable naming convention doesn&#x27;t work out?
评论 #20351573 未加载
评论 #20351779 未加载
jimktrains2将近 6 年前
I guess I&#x27;m confused as to the specificity of this. Why are a paternal uncle&#x27;s daughters not included? Why only elder?<p>Also curious as to why this is important enough to have a specific type of contact for?
floatingatoll将近 6 年前
It’s kind of nice seeing the homepage with a fixed row height per story! I guess it will not last bit that was a nice thing that came of this. Thanks, OP :)
tintintin将近 6 年前
For those using Refined Hacker News[1] for Firefox on Android, you can add this to the <i>Custom CSS</i> field to prevent the overflow:<p><pre><code> tr.athing td.title:not([valign=&quot;top&quot;]) { word-break: break-word; } </code></pre> [1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;plibither8&#x2F;refined-hacker-news" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;plibither8&#x2F;refined-hacker-news</a>
ridiculous_fish将近 6 年前
Winforms has some gems:<p>DataGridViewColumnDividerDoubleClickEventArgs<p>ListViewVirtualItemsSelectionRangeChangedEventHandler
评论 #20351999 未加载
sbr464将近 6 年前
This is a joke right? Please explain if not. Why wouldn’t you just name the variable relationship (or CNRelationship to adhere to nonsensical globals) and abstract the method for getting there to other logic?
enriquto将近 6 年前
Camel case needs to die, it&#x27;s been too long and it&#x27;s not funny anymore.
ttflee将近 6 年前
Could these ever be swiftified as enums?
peapicker将近 6 年前
Well first cousin anyway.
jeromebaek将近 6 年前
Help, this post is breaking Hacker News mobile because the title is too long without spaces.
tolgahanuzun将近 6 年前
wat? :D
dshields1将近 6 年前
That label is so long it’s breaking the HN front page layout for me on mobile.
评论 #20351533 未加载
评论 #20351478 未加载
评论 #20351462 未加载
评论 #20352488 未加载
评论 #20351687 未加载
评论 #20351594 未加载
评论 #20351717 未加载
评论 #20356095 未加载
评论 #20352267 未加载
mgranados将近 6 年前
¯\_(ツ)_&#x2F;¯