TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Want to Unlock Performance and Clarity? Use Strong Types

5 pointsby bubblehack3r12 months ago

3 comments

rlupi12 months ago
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 months ago
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 months ago
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.