Live data from Hacker News

Ruby 2.6

anamaria.martinezgomez.name

101–110 of 164 posts

Re: Ruby 2.6

#101
post #71
post #38

Earlier quoted context omitted.

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

Interesting. What’s your opinions on Crystal right now as a substitute for Ruby? Is there a good stack like Rails for Crystal?

Take a look at Lucky framework!

https://luckyframework.org

Re: Ruby 2.6

#102
post #73

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 is as good time as to, say, learn Farsi. It's beautiful, it's fun, learning it is a great experience, and, plus, quite a few people already enjoy speaking it. Or, you could learn something else without feeling much of a loss.

Almost has nothing to do with learning Farsi, great analogy otherwise

Re: Ruby 2.6

#103
Fantastic Christmas present from the Ruby team.

Ruby is alive and well despite all the rumors of it's demise. I predict a resurgence in its use over the next few years.

Can't wait to examine and try out the new features.

Re: Ruby 2.6

#104

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 recommend a post/article explaining some of what makes Ruby's collections especially pleasant? Studying Ruby's stdlib design has been on my 'someday' list, but there's so much else there...

It's mostly how complete the API is and how consistent. For example: * Hash#merge takes a block for conflict resolution. I use this all the time for aggregating counts. * #sample * #unique * Everything has a change in place option by appending "!"

Re: Ruby 2.6

#105

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 recommend a post/article explaining some of what makes Ruby's collections especially pleasant? Studying Ruby's stdlib design has been on my 'someday' list, but there's so much else there...

one beautiful design decision ruby made really on was that every method would have the option to take a block of code when it was invoked. the code block gets passed to the method as a closure. this makes writing collection apis very pleasant, since so many of them involve passing in a single closure to operate on each element.

Re: Ruby 2.6

#106
post #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.

Crystal is definitely not production ready, I mean a language without thread support...

Re: Ruby 2.6

#107
post #71
post #38

Earlier quoted context omitted.

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

Interesting. What’s your opinions on Crystal right now as a substitute for Ruby? Is there a good stack like Rails for Crystal?

Quite immature, especially when it comes to community and library support.

But dang it's nice to do stuff in it.

Re: Ruby 2.6

#108
post #33

Earlier quoted context omitted.

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.

I don't think you got that index calculation right. -1 in array of 5 elements is located at 5-1 == 4, not at 1%5 == 1.

It depends on how you define the modulo operator [0]--there are definitions where (-1)%5 == 4 and definitions where (-1)%5 == -1. Presumably the GP is referring to the former case.

[0]: https://en.wikipedia.org/wiki/Modulo_operation#Remainder_cal...

Re: Ruby 2.6

#109
post #42

This will be fun. I’m glad we now have some performance improvements to some common methods. For those considering playing with Ruby, you should! One thing I’m surprised not many has mentioned what makes ruby unique and awesome, BLOCKS!

Scala and Kotlin let you achieve something similar, without requiring a dedicated `yield` keyword, as well as not introducing yet another type of function into the language... Personally, I always found the number of different types of function in Ruby to be bewildering.

Scala even allows multiple blocks to be passed in, used to good effect in the Cats effect `bracket` function, amongst others.

Re: Ruby 2.6

#110

Earlier quoted context omitted.

what bout clojure?

Clojure's stdlib is unintuitive, and `into` is the poster child. It's easy to find what's available in Ruby: https://ruby-doc.org/core-2.5.3/Enumerable.html Good luck with Clojure: https://clojure.github.io/clojure/clojure.core-api.html

https://clojuredocs.org/ is what I always used. I dislike ruby's docs actually. Rust and Crystal have better UX design for their docs.
Post reply on HN