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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Unhelpful abstractions

26 点作者 spacey超过 9 年前

2 条评论

mmarx超过 9 年前
&gt; Specifically, now every caller to this function has to pass in a mode value, even if the file exists, even if they don’t really care and are happy with a default file mode.<p>Wouldn&#x27;t this be solved by allowing for optional arguments (which go doesn&#x27;t seem to support)? Also, why not just _explicitly_ set the file mode, even if the file still exists (as otherwise it would fail anyways)?
评论 #11052982 未加载
junke超过 9 年前
&gt; Sometimes it’s better to be explicit than abstract.<p>This is a false dichotomy: after all, &quot;open&quot; is explicit and abstract (w.r.t. actual file systems).<p>The original article from Metz was interesting, but the example here is disappointing. The code was apparently used only once: why generalize?<p>And if you want to generalize, why not make use of two functions: a new one which implements &quot;touch&quot;, and the existing os.Chmod?
评论 #11061603 未加载