Live data from Hacker News

Ruby 2.6

anamaria.martinezgomez.name

51–60 of 164 posts

Re: Ruby 2.6

#51

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…

Can you comment on why a good type system became so important to you? I can understand the value in interfaces but not really in any other context.

Re: Ruby 2.6

#52
post #21

> Constant names can now start with non-ASCII capital letters. I am not sure how useful this is Very? If you want to code in non-Latin languages. Also, π = 3.14159

I'm not sure about this being good for coding in non-latin. It might actually encourage behavior to mistreat ruby constants as regular variables. IIRC constants are not really constant, but only visual help for reading code and ruby just issues a warning on reassignment and these warnings are not shown by default. I can totally imagine new devs just trying out non-ascii variables, see it not crashing and then actuall…

Re-assignment warns by default. I tried it, exploring to see what was possible. It indeed worked but threw a warning. I hadn't changed configuration.

Re: Ruby 2.6

#53

What is the complexity of set operations on arrays? This seems a bit too much sugar to me, to the point where people will end up writing inefficient code because they will thing these methods are more performant than they really are. Usually, I like to see explicit conversions to sets to make the performance characteristics explicit.

I haven't used Ruby before but I'd have to guess that their Array implementation utilities table doubling, if this is the case operations like concat, union, and difference should be linear.

Re: Ruby 2.6

#54

What is the complexity of set operations on arrays? This seems a bit too much sugar to me, to the point where people will end up writing inefficient code because they will thing these methods are more performant than they really are. Usually, I like to see explicit conversions to sets to make the performance characteristics explicit.

[deleted]

Re: Ruby 2.6

#55

What is the complexity of set operations on arrays? This seems a bit too much sugar to me, to the point where people will end up writing inefficient code because they will thing these methods are more performant than they really are. Usually, I like to see explicit conversions to sets to make the performance characteristics explicit.

In most real world applications, the cost of doing an in-memory data manipulation like this is negligible compared to I/O, waiting for the database etc. It's already the wrong language for someone who wants to squeeze out every CPU cycle, and imo it's a Good Thing for a language upgrade to embrace its strengths ie syntax sugar in the case of Ruby, as long as the perf hit isn't out of control.

I'd agree developers should pick the right data structure for the job and some APIs can obscure the cost to the point of misleading developers into woefully wrong decisions. I just don't think it's the case with array ops like union as it's easy enough to handle them efficiently. I too would be interested to see any benchmarks though.

Re: Ruby 2.6

#56

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…

Can you comment on why a good type system became so important to you? I can understand the value in interfaces but not really in any other context.

Fewer run time errors. Easier testing, among other things.

Re: Ruby 2.6

#57

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!

It’s a good time to learn any language if it has any popularity at all.

Re: Ruby 2.6

#58

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…

what bout clojure?

Re: Ruby 2.6

#59

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…

Can you comment on why a good type system became so important to you? I can understand the value in interfaces but not really in any other context.

Not having `nil` is soooo nice. I can't count the number of `Runtime Error`s because some method isn't defined on `NilClass` that have blown things up in weird edge cases.

Knowing exactly what types a method takes and the compiler catching incorrect uses before the code ever runs saves a lot of frustration. Another thing I've enjoyed in Rust include `match` clauses forcing me to define branches for any possibility, especially for `Result` structs. In ruby this isn't possible because anything can be anything.

Re: Ruby 2.6

#60

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?

> Are there any benchmarks for the new JIT?

From the horse's mouth:

"...apparently JIT on Ruby 2.6 failed to be ready for production." [1]

[1] https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future...

Post reply on HN