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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Past, present, and future of Sorbet type syntax

122 点作者 PaulHoule大约 17 小时前

8 条评论

status_quo69大约 13 小时前
One thing that I&#x27;ve wondered is why sorbet didn&#x27;t choose to use the stabby lambda syntax to denote function signatures?<p><pre><code> sig -&gt;(_: MyData) { } def self.example(my_data) ... end </code></pre> Obviously this opens up a potential can of worms of a dynamic static type system, but it looks sufficiently close enough to just ruby. My opinion is that sorbet doesn&#x27;t lean into the weirdness of ruby enough, so while it has the potential to be an amazingly productive tool, this is the same community that (mostly) embraces multiple ways of doing things for aesthetic purposes. For example you could get the default values of the lambda above to determine the types of the args by calling the lambda with dummy values and capturing via binding.<p>Personally having written ruby&#x2F;rails&#x2F;c#&#x2F;etc and having been on a dev productivity team myself, I say: lean into the weird shit and make a dsl for this since that&#x27;s what it wants to be anyways. People will always complain, especially with ruby&#x2F;rails.
评论 #43942585 未加载
usernamed7大约 16 小时前
I&#x27;ve been a ruby dev for 15+ years; i&#x27;d really love it if ruby adopted a C# similar approach to typing (albeit, more ruby-like and more flexible). It&#x27;s the most readable, simplest way I would enjoy as a rubyist. Everything else (including sorbet) feels bolted on, cumbersome and cringe. I appreciate the article and how it goes over the constraints; but genuinely sorbet is just not good enough from a DSL standpoint.<p>Type&#x27;s can be fun and useful, and i&#x27;d love to see them incorporated into ruby in a tasteful way. i don&#x27;t want it to become a new thing developers are forced to do, but there is a lot of utility from making them more available.
评论 #43939171 未加载
评论 #43941223 未加载
评论 #43943184 未加载
评论 #43939512 未加载
评论 #43939151 未加载
Trasmatta大约 14 小时前
When it comes to &quot;Ruby-like and statically typed&quot;, Crystal is such an amazing language. I think the design is incredible, but every time I try to use it, I just hit so many issues and things that slow me down. I think it&#x27;s such a cool language, but every time I try to use it I just end up switching back to Ruby.
评论 #43942319 未加载
评论 #43940375 未加载
评论 #43940635 未加载
评论 #43940521 未加载
dismalaf大约 17 小时前
Interesting article, but to me it really defeats the point of Ruby. The hyper-dynamic &quot;everything is an object&quot; in the Smalltalk sense of the definition is much of what makes Ruby great. I hate this idea that Ruby needs to be more like Python or Typescript; if you like those languages use those languages.<p>I get that a lack of types is a problem for massive organizations but turning dynamic languages into typed languages is a time sink for solo developers and small organizations for zero performance benefit. If I wanted a typed language to build web apps with I&#x27;d use Java or something.<p>Hopefully Matz sticks to his guns and never allows type annotations at the language and VM level.
评论 #43939836 未加载
评论 #43942072 未加载
评论 #43943503 未加载
评论 #43938994 未加载
评论 #43940906 未加载
throwaway346434大约 14 小时前
&gt; There was also a project called TypedRuby, largely a passion project of an engineer working at GitHub. After a few weeks of evaluation, it seemed that there were enough bugs in the project that fixing them would involve a near complete rewrite of the project anyways.<p>There&#x27;s 6 open bugs and 4 closed ones. This seems like either it&#x27;s throwing shade or they didn&#x27;t bother lodging bug reports upstream.
评论 #43940180 未加载
评论 #43942277 未加载
breckinloggins大约 14 小时前
&gt; My counter is that when it comes to language design, semantics—what the types mean—are easily 10 times more important than syntax<p>Sometimes I long for the days before type theory took over programming language research.
评论 #43940419 未加载
评论 #43942278 未加载
gitroom大约 13 小时前
man i always bounce between loving ruby&#x27;s speed to build and wishing for just a bit more built-in safety tbh. you ever feel like adding more types actually slows you down or does it make big teams way less stressed?
评论 #43940690 未加载
评论 #43942275 未加载
评论 #43942282 未加载
uticus大约 14 小时前
it&#x27;s amazing to me that the industry hasn&#x27;t found a better way to support bits of code interacting with other bits of code properly, than adding an attribute to a bit of code calling it a &quot;type&quot;<p>...saying this as someone who benefits from it but also rarely uses sub-typing (&quot;poodle&quot; type sub to &quot;dog&quot; type sub to &quot;animal&quot; type) or any sort of the other benefits that are commonly associated with typing. for me the benefit is code checking and code navigation of unfamiliar code bases
评论 #43940483 未加载