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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Want to Unlock Performance and Clarity? Use Strong Types

5 点作者 bubblehack3r12 个月前

3 条评论

rlupi12 个月前
Interesting, I haven&#x27;t thought about using it in C++ before.<p>It&#x27;s an idea that has existed for a long time in languages geared toward safety-critical systems.<p>E.g. Derived Types in Ada: <a href="https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;designing-with-types-discovering-the-domain&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;designing-with-types...</a><p>It is sometimes used in Ocaml or F# for domain-specific types: <a href="https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;discriminated-unions&#x2F;#single-cases" rel="nofollow">https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;discriminated-unions...</a>
tomtom133712 个月前
This is a very useful methodology. There&#x27;s a similar blog post called &quot;parse, don&#x27;t validate&quot; [1] which is very good.<p>[1] <a href="https:&#x2F;&#x2F;lexi-lambda.github.io&#x2F;blog&#x2F;2019&#x2F;11&#x2F;05&#x2F;parse-don-t-validate&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lexi-lambda.github.io&#x2F;blog&#x2F;2019&#x2F;11&#x2F;05&#x2F;parse-don-t-va...</a>
lylejantzi3rd12 个月前
So, every time you create a UserName, it does those checks even if it doesn&#x27;t need to? That doesn&#x27;t sound very performant to me.