Live data from Hacker News

Ruby 2.6

anamaria.martinezgomez.name

31–40 of 164 posts

Re: Ruby 2.6

#31

Earlier quoted context omitted.

As good as any time. You will loose a lot of performance when compared to v8 but the ruby paradigm is subjectively much more pleasant to work with.

Enumerable methods are almos always what make me want to ditch Javascript for Ruby.

Have a look at:

https://ramdajs.com/

Re: Ruby 2.6

#32

Is it a good time to learn Ruby? I mostly do React and Node + Java work professionally, but I've been looking into Ruby as a fun side project language. I would appreciate any anecdotes!

I am a big fan of Ruby. The syntax and stdlib let you write code that is very close to a natural English sentence. For example, Ruby has both `if` and `unless`, so you can express a condition as `unless condition` instead of `if !condition`. And the frankly great Enumerable module provides a great collections API, miles ahead of Java in particular. If you're sick of writing for-loops I recommend giving Ruby a try!

Re: Ruby 2.6

#33
post #26

Really like the idea of using lazy ranges instead of magic negative indices! I.e `xs[6..]` instead of `xs[6..-1]`.

Negative indices aren't magic. They follow the obvious wraparound (modular) pattern: Negative `i` indexes the element in array `a` located at `i % len(a)`. If they worked any other way it'd be madness.

Re: Ruby 2.6

#34

I am always happy to unwrap my Christmas present from the Ruby team! Some questions about this release: - Are there any benchmarks for the new JIT? - Why was `(Date.today..(Date.today + 1)) === DateTime.now #=> true` false in Ruby 2.5? It seems correct that right now is between today and tomorrow. Is it because one is a Date and the other a DateTime?

Been a while since I’ve used any Ruby but isn’t the first expression a range where’s the second a single value?

It’d be like [0,1] === 0

Re: Ruby 2.6

#35
post #34

I am always happy to unwrap my Christmas present from the Ruby team! Some questions about this release: - Are there any benchmarks for the new JIT? - Why was `(Date.today..(Date.today + 1)) === DateTime.now #=> true` false in Ruby 2.5? It seems correct that right now is between today and tomorrow. Is it because one is a Date and the other a DateTime?

Been a while since I’ve used any Ruby but isn’t the first expression a range where’s the second a single value? It’d be like [0,1] === 0

> isn’t the first expression a range where’s the second a single value?

`===` conventionally means 'matches', or 'includes', so an aggregate on the LHS and a scalar on the RHS is typical.

It isn't defined for `Array` beyond being the default of equality - I don't know why - but it is defined for `Range`.

Re: Ruby 2.6

#36
post #28
post #24

I was trying to go download the latest Ruby or even read the latest release notes, but the site seems to be down. It's still ruby-lang.org, right?

Weird. I googled "ruby 2.6 download" and links from the results worked, but simply trying to browse to "ruby-lang.org" times out.

It just resolved for me. Maybe it'll clear up for you soon!

Re: Ruby 2.6

#37
Ruby used to be my most beloved language. I've since developed a strong appreciation for good type system. However, working with collections of any kind in Ruby is just such a joy. The methods around it are so well thought throug and make writing code a joy that in most other languages just would be tedious. On top of that the Ruby team is constantly working on making that aspect even better. I truly don't understand why it seems to me that no other language I use makes even an effort to provide something similar. Getting a map, a reduce and a filter function seems to be as far as most standard libraries are willing to go.

Re: Ruby 2.6

#38

Ruby used to be my most beloved language. I've since developed a strong appreciation for good type system. However, working with collections of any kind in Ruby is just such a joy. The methods around it are so well thought throug and make writing code a joy that in most other languages just would be tedious. On top of that the Ruby team is constantly working on making that aspect even better. I truly don't understand…

Try Crystal and you get the joy of Ruby enumerables together with a static type system.

Re: Ruby 2.6

#40
post #6

Earlier quoted context omitted.

Have you looked at crystal ( https://crystal-lang.org/ ) ? Very ruby-like, but has additional safeties and compiles to native.

It looks fun, but as I'm doing financial modelling right now, Julia may be a better fit for me, as it has very nice libraries as well.

You may want to check APL family as a possible option for prototyping at least.
Post reply on HN