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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Which function definition keyword do you prefer, def or fn?

1 点作者 winwang2 天前
I&#x27;m curious about what people think of `def` vs `fn`, two short keywords for starting function definitions.<p>...Or maybe we should subscribe to the church of `df`, haha.

2 条评论

johncoltrane1 天前
&quot;def&quot; is too generic.<p>&quot;fn&quot; is too cryptic.<p>&quot;function&quot; is better than the two.
评论 #43948316 未加载
sitkack2 天前
def could be for lots of things, fn is for functions. I don&#x27;t think it matters much as long as you have one. C would have been so much easier to parse. Just copy Zig or Rust.
评论 #43948426 未加载