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.

New Features in Ruby 2.4

222 pointsby jbackusalmost 9 years ago

12 comments

saghmalmost 9 years ago
Some of these are pretty amazing, like the `digits` method and the new OptionParser functionality (which seems to be a sort of standard library equivalent to doctopt!).<p>That being said, I can&#x27;t help but shake my head at the section about &quot;multiple assignment of conditionals:<p>&quot;You can now assign multiple variables within a conditional...You probably shouldn’t do that though.&quot;<p>Am I alone and thinking that it&#x27;s a little bit hypocritical to specifically add functionality to your language if you don&#x27;t want people to use it? Or is this just a joke that&#x27;s gone over my head?
评论 #12135578 未加载
评论 #12135277 未加载
评论 #12135615 未加载
评论 #12136136 未加载
评论 #12135261 未加载
评论 #12135266 未加载
评论 #12136447 未加载
windoralmost 9 years ago
Ruby is the first language I really like. The core concept of the language is small, just not easy to get, but the change on how to programming is significant. Sadly, Ruby is not the language for the multi-core world, and many advantages of using it is disappearing. Although Ruby is changing, 2.3, 2.4, maybe 3.0, but what&#x27;s the difference?
评论 #12137530 未加载
评论 #12137070 未加载
评论 #12145907 未加载
评论 #12136460 未加载
评论 #12136023 未加载
评论 #12147321 未加载
评论 #12137071 未加载
jewbaccaalmost 9 years ago
&gt; <i>If you are calling #sum on an array of non-integers then you need to provide your own initial value</i><p>Why? This doesn&#x27;t seem necessary, but, more importantly, would be inconsistent with #inject&#x27;s behaviour (if enforced).<p>----<p><a href="http:&#x2F;&#x2F;ruby-doc.org&#x2F;core-2.3.1&#x2F;Enumerable.html#method-i-inject" rel="nofollow">http:&#x2F;&#x2F;ruby-doc.org&#x2F;core-2.3.1&#x2F;Enumerable.html#method-i-inje...</a>:<p><i>If you do not explicitly specify an initial value for memo, then the first element of collection is used as the initial value of memo</i>
评论 #12135471 未加载
Olap84almost 9 years ago
Will this be the last release before 3? Is there a defined schedule for 3 yet? Or just &quot;When it&#x27;s done&quot;?
评论 #12136326 未加载
ukokialmost 9 years ago
digits method just saved code-golfers 20 characters.<p>`num.to_s.split(&#x2F;&#x2F;).map(&amp;:to_i)` =&gt; `num.digits`
评论 #12136368 未加载
评论 #12135506 未加载
mark_l_watsonalmost 9 years ago
Great to see my favorite language evolving! I also use various lisps, Java, Haskell, Typescript, JavaScript, Python, etc., but I am happiest when coding in Ruby.<p>Unfortunately, most of what I do now is machine learning, and Python wrappers for underlying C++ code have by far more support than Ruby. (Ruby does have some great ML projects and libraries though).
评论 #12155576 未加载
评论 #12137269 未加载
sergiotapiaalmost 9 years ago
Ruby 2.4 adds a new #match? method for regular expressions which is three times faster than any Regexp method in Ruby 2.3:<p>Why does Ruby have 4 different regexp match functions?<p>Regexp#match?: 2630002.5 i&#x2F;s Regexp#===: 872217.5 i&#x2F;s - 3.02x slower Regexp#=~: 859713.0 i&#x2F;s - 3.06x slower Regexp#match: 539361.3 i&#x2F;s - 4.88x slower
评论 #12135575 未加载
pmarreckalmost 9 years ago
Ruby continues to serve as a continuously fresh inspiration for Elixir. ;)
toolzalmost 9 years ago
Why do the old match operators now implicitly set a global variable? I feel like in a year I&#x27;m going to be debugging some really weird race conditions because of that change and I can&#x27;t see any value in it...if I want to use the value of a match operator I&#x27;ll _always_ save it to a local variable.<p>Can anyone shed any light on this, because my first attempts at grok&#x27;ing this change have me really blown away.
评论 #12137361 未加载
评论 #12137386 未加载
评论 #12139332 未加载
proyb2almost 9 years ago
This code doesn&#x27;t make sense.<p><pre><code> 123.digits # =&gt; [3, 2, 1]</code></pre>
评论 #12135464 未加载
评论 #12137398 未加载
dkarapetyanalmost 9 years ago
These are all great but when are we getting optional typing? If the js ecosystem wasn&#x27;t a clown operation my language of choice would be typescript instead of ruby.
评论 #12136067 未加载
评论 #12137410 未加载
integriialmost 9 years ago
Ruby syntax is just getting goofier and goofier.
评论 #12135317 未加载