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.

Stripe is building a Ruby typechecker

4 pointsby kmfalmost 7 years ago

1 comment

ezekgalmost 7 years ago
This looks really cool, and something I&#x27;ve wished had existed in the past. Have you thought of doing unions with a syntax like this, following after languages like Crystal, TS, Elm, etc?<p><pre><code> class A sig(foo: TrueClass | FalseClass).returns(String) def bar(foo) foo.to_s end end </code></pre> The T.any(…) syntax seems very … verbose, for Ruby at least. And Ruby doesn&#x27;t have a true &quot;boolean&quot; class (it has TrueClass&#x2F;FalseClass), so that would be riddled everywhere unless you created a boolean type yourself. Same for indifferent hashes, i.e. a hash with keys of type T.any(String, Symbol).