Live data from Hacker News

Ruby 2.6

anamaria.martinezgomez.name

151–160 of 164 posts

Re: Ruby 2.6

#151
post #146

Earlier quoted context omitted.

Also, chaining is extremely concise. e.g. "products.map(&:cost).sort.last"

I couldn't resist... Your example could be improved by using "products.sort_by(&:cost).last" I try to not use map because often there are methods that already implement filtering. Gotta love Ruby readability.

I think you need `products.sort_by(&:cost).last.cost` for the same result.

Re: Ruby 2.6

#152

Earlier quoted context omitted.

JRuby threads are fully parallel and in production use today. CRuby's GIL is an implementation choice rather a property of dynamic/interpreted languages.

Is it really a "choice" if the alternative is really hard to achieve in practice? It's like calling python's GIL a choice... with numerous projects trying to get rid of it in various ways and never really succeeding to do it while keeping the single threaded performance and the extensions API.

It is a choice to keep backwards compatibility with the C extensions API.

The GIL would be quite easy to replace otherwise.

Re: Ruby 2.6

#153

Earlier quoted context omitted.

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.

Languages without ADTs and Optionals just feel impoverished.

Languages without dependent types feel that something is still missing.

Re: Ruby 2.6

#154

Earlier quoted context omitted.

Depends what you want to do, 90% of what I code in is python or Ruby, and I'll switch to C when I want performance. I've done a lot of rails (Ruby), Django (python), and flask (python) work in web development. Much prefer rails, eaiser, and better thought out. I have several websites with hundreds of thousands of visits a year, it is fine (all the frameworks are). I have had to do some inline C to speed up my Ruby in…

You should give crystal a go for the parts you need to be performant! You can even prototype those parts in ruby and easily convert to crystal when it becomes necessary. We’ve found a really nice balance, with business logic and interfaces in Ruby/Rails and crystal for AI/data processing.

Crystal usage in actual Production ? Any pitfalls?

Re: Ruby 2.6

#155
post #40

Earlier quoted context omitted.

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.

APL itself looks really really bad language with bad documentation, no real libraries, non-existent type system, bad function names, and I don't see any GPU programming support in it. In the family Matlab is still the best (It can do Monte Carlo simulation on the GPU, and has a great library for different distributions), but it's still much slower language than Julia generally.

Re: Ruby 2.6

#156
post #146

Earlier quoted context omitted.

I couldn't resist... Your example could be improved by using "products.sort_by(&:cost).last" I try to not use map because often there are methods that already implement filtering. Gotta love Ruby readability.

I think you need `products.sort_by(&:cost).last.cost` for the same result.

You’re correct!

Re: Ruby 2.6

#157

Earlier quoted context omitted.

In Ruby it can easily be used to submit malicious source code to a repository (for example the reviewers thinking that a variable is set to some value, when in fact a new variable is created).

An attacker would still have to _do_ something with their new maliciously named constant, which would be as noticeable as any other malicious contribution. This is grasping at straws.

Not really, just thinking that an operation changes a variable when it in fact doesn't is enough to introduce a security vulnerability.

Re: Ruby 2.6

#158

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…

Groovy. Probably because Groovy borrowed quite a lot from Ruby.

Definitely. I dabbled in Ruby but kept coming back to Groovy because it had all the nice syntax of Ruby but all the advantages of the JVM, solid Java ecosystem / libraries and optional strong / static typing to apply when valuable (eg: defining interfaces or data types).

Re: Ruby 2.6

#159
post #139

Earlier quoted context omitted.

What do you use Coroutines in a static language like Java, for ?

Everywhere I used to use CompleteableFutures, except without ending up with completely unmaintainable code. https://github.com/Kotlin/kotlinx.coroutines/blob/master/cor...

Very interesting, thanks!

Re: Ruby 2.6

#160
post #152

Earlier quoted context omitted.

Is it really a "choice" if the alternative is really hard to achieve in practice? It's like calling python's GIL a choice... with numerous projects trying to get rid of it in various ways and never really succeeding to do it while keeping the single threaded performance and the extensions API.

It is a choice to keep backwards compatibility with the C extensions API. The GIL would be quite easy to replace otherwise.

> It is a choice to keep backwards compatibility with the C extensions API.

IIUC for CRuby it's mostly about how to keep the VM simple. Koichi Sasada is working on an ownership based model like Erlang has, which sidesteps a bunch of theses issues.

Post reply on HN