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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ruby 2.7

336 点作者 sadiqmmm超过 5 年前

10 条评论

seanmccann超过 5 年前
I had wondered why most recent Ruby releases were on Christmas Day and recently found out why. The Ruby creator Matz is religious (LDS), and he considers it a Christmas gift to the community. I thought that was really cool.
ufo超过 5 年前
One of the interesting news is that they are now going to start requiring a C99 compiler, instead of only C90.<p>I&#x27;ve been considering to do the same on my own projects. What does HN have to say about this? Is anyone here still working in a context where C99 is not an option? Did anyone else also recently switch to C99? How did it go?
评论 #21879894 未加载
评论 #21879248 未加载
评论 #21879206 未加载
burlesona超过 5 年前
&gt; Calling a private method with a literal self as the receiver is now allowed.<p>Oof. Call me old fashioned, but I liked the consistency of not being able to call private methods with an explicit receiver. Oh well!<p>The rest of this looks great, thanks Ruby team!
评论 #21880338 未加载
faitswulff超过 5 年前
I know it&#x27;s slow at the moment, but is anyone planning on using pattern matching for anything in particular? Curious what use cases are particularly suitable for it.
评论 #21878359 未加载
sergiotapia超过 5 年前
Pattern matching is awesome in Elixir, it&#x27;s great to see functional language traits stain the Ruby language more. It&#x27;s all the better for it.
评论 #21878883 未加载
评论 #21879051 未加载
评论 #21878965 未加载
z92超过 5 年前
The compaction GC was the most important change. I haven&#x27;t measured Ruby&#x27;s performance specifically but in general the difference and improvements over a non-compacting GC is so huge. Specially for long running processes.
评论 #21879749 未加载
评论 #21879664 未加载
mattmarcus超过 5 年前
I&#x27;m most excited for <i>Enumerable#tally</i> for counting occurrences of elements.<p>From the example in the release:<p><pre><code> [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;b&quot;].tally #=&gt; {&quot;a&quot;=&gt;1, &quot;b&quot;=&gt;2, &quot;c&quot;=&gt;1} </code></pre> There&#x27;s more about this change here (<a href="https:&#x2F;&#x2F;medium.com&#x2F;@baweaver&#x2F;ruby-2-7-enumerable-tally-a706a5fb11ea" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@baweaver&#x2F;ruby-2-7-enumerable-tally-a706a...</a>). I probably do this a few times a week:<p><pre><code> list.each_with_object(Hash.new(0)) { |v, h| h[v.something] += 1 }</code></pre>
评论 #21880702 未加载
评论 #21881772 未加载
tyingq超过 5 年前
Does the pattern matching do something that Ruby&#x27;s map() can&#x27;t do?<p>Coming from Perl, map() there can return fewer elements than the source list, so pattern matching works already. A short skim of Ruby&#x27;s map seems to imply it always returns something with the same number of elements.<p>Edit: I was confused about what this feature did. So this subthread is still interesting, but mostly unrelated.
评论 #21878562 未加载
评论 #21878657 未加载
claudiug超过 5 年前
great! i truly like this language.
评论 #21878611 未加载
atraktor超过 5 年前
Love Matz &amp; Ruby, Merry Christmas!