命名参数不是语法糖,是给程序员的体面
原创
你有多久没被函数参数搞晕过?Corrode 语言团队最近宣布原生支持命名参数。说实话,我觉得这是个被低估的设计。位置参数在简单场景下够用,但函数一复杂、调用方就变成查文档的机器人。命名参数把意图直接写在调用现场,代码读起来像人话。争议当然有——性能开销、与位置参数的兼容性、语言整体风格的一致性,每个都要权衡。但站在系统编程的视角,可读性换来的维护成本节省,长期看远比那点运行时开销值钱。一个小语言做这件事不算稀奇,稀奇的是社区在认真讨论它而不是把它当成语法糖一笔带过。
原文:We Have Named Arguments at Home · 来源:Hacker News
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
相关文章
- 0.05ms 往返:localhost 为什么不能直接当网站?
- Fornax's Guide to Fast Ethernet
- Possibly leaked NSA Cyberattack tool behind attacks (2017)
- Steve Wozniak on Writing Apple Integer Basic
- PayByPhone is stealing $50M/year from their users
- Grand Theft Auto 6: A Landmark Achievement That Redefines a Console Generation
- Research Acceleration: The Jagged Frontier
- Google Embraces Geothermal Technology to Vaporize Rock for Clean Power
- Microsoft's Agent Framework PyPI package compromised to steal credentials
- Nvidia's Seven Billionaires Have Lost a Third of Their Wealth
最新文章
- 0.05ms 往返:localhost 为什么不能直接当网站? 20小时前
- Fornax's Guide to Fast Ethernet 20小时前
- Possibly leaked NSA Cyberattack tool behind attacks (2017) 21小时前
- Steve Wozniak on Writing Apple Integer Basic 21小时前
- PayByPhone is stealing $50M/year from their users 21小时前
- Grand Theft Auto 6: A Landmark Achievement That Redefines a Console Generation 21小时前
- Research Acceleration: The Jagged Frontier 22小时前
- Google Embraces Geothermal Technology to Vaporize Rock for Clean Power 23小时前
- Microsoft's Agent Framework PyPI package compromised to steal credentials 24小时前
- Nvidia's Seven Billionaires Have Lost a Third of Their Wealth 24小时前
itfan123





