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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Objective-C Lessons from Go

29 点作者 mackross将近 12 年前

2 条评论

objclxt将近 12 年前
&gt; <i>So, the next time you’re about to make a subclass. Think hard and ask yourself — what would Go do.</i><p>I enjoy using both languages (Objective-C by day, Go by night), but I&#x27;m not sure this advice is necessarily something I would follow.<p>Because at the root of it all, Go is procedural and Objective-C is object-oriented. But the word &quot;procedural&quot; (or &quot;imperative&quot;) isn&#x27;t mentioned <i>once</i> in this blog post...it seems as if maybe the author missed something here? For example:<p>&gt;<i>In Go, composition of existing classes is trivial</i><p>...classes simply don&#x27;t exist in Go. Composition of <i>interfaces</i>, yes, not classes. And maybe that&#x27;s me being picky, but I think it&#x27;s a really important distinction. One of the reasons I think the author found taking this further &quot;incredibly difficult&quot; is that the two methodologies <i>are</i> very different and perhaps shouldn&#x27;t mix.<p>Maybe other people will have differing views, but I honestly don&#x27;t know whether it is <i>worth</i> trying to impose a procedural viewpoint onto a overtly object orientated language (or vice versa). So to throw this open: am I missing something here?
评论 #5969742 未加载
评论 #5969622 未加载
评论 #5969604 未加载
评论 #5969975 未加载
tomlu将近 12 年前
All well and good, but keep in mind there&#x27;s a fair bit of boilerplate to this way of composing classes and you don&#x27;t get any type checking when you use dynamic forwarding.