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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Good ideas for naming functions

1 点作者 aliencat将近 10 年前
I&#x27;ve came across the extra vocabularies such as `?`(return boolean) and `!`(destructive) for naming functions and variables. IMO they are much better more intuitive than names such as `is_...`, and I can&#x27;t think of a good way to name destructive functions in language such as Python, C, java.<p>Is there a good convention&#x2F;idea to name your functions wisely that are less verbose and straight to the point?

1 comment

dudul将近 10 年前
Some languages use mathematical symbols to name functions that are derived from mathematical rules&#x2F;principles (e.g. the Scalaz library). I think it&#x27;s a good idea. If you&#x27;re implementing function composition, just use the mathematical symbol for composition, don&#x27;t pull a new name out of a hat.<p>A lot of people complain about it, the main reasons being:<p>- it&#x27;s annoying to type - a lot of developers actually don&#x27;t have a math background and have no idea what the symbols mean