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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Explicit is better than implicit

19 点作者 ludovicianul8 个月前

3 条评论

ddejohn8 个月前
This article has virtually nothing to do with implicit vs explicit code. The examples are just poorly written and poorly documented code. And even the "improvements" aren't that great. Why does `grantAccess` return permissions the user role already has?
评论 #41454151 未加载
sakjur8 个月前
In both ACL examples, if I send in a user that has the role “adnim” it’ll quietly and happily treat that as the same as “guest”.<p>You can certainly make that design decision, but I think my take of “explicit is better than implicit” is to let the server logs complain about invalid roles (and then rejecting access, even if a guest would’ve had access).
rednafi8 个月前
Seems like slop.