Live data from Hacker News

Ruby 2.6

anamaria.martinezgomez.name

41–50 of 164 posts

Re: Ruby 2.6

#41
post #7

Earlier quoted context omitted.

Ruby isn't perfect but it's a great utility language and can do a lot of powerful things with very little effort. Read through Eloquent Ruby The only problems I wouldn't go to Ruby for are CPU intensive ones or ones where I need parallel threads (which you already have Java for)

You can also use JRuby. Powerful and can be very easy to the user.

Had a problem that I'd typically use Ruby for but needed to shed the GIL. JRuby worked beautifully. The only gotcha was I needed to use the JDBC driver for Sequel instead of the usual drivers. Obvious in hindsight but not so much with zero JVM development experience. I'd use it again.

Re: Ruby 2.6

#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!

Re: Ruby 2.6

#44

Earlier quoted context omitted.

it can be used to create malicious pull requests that are visually indistinguishable from correct ones

> it can be used to create malicious pull requests that are visually indistinguishable from correct ones If your only check on the correctness of submitted code is visual inspection, you've got a much bigger problem than Unicode confusability.

How do you check your code? Presumably, you’re not able to exercise the full range of inputs, so at some point you will have to look at the code and figure out what it is doing…

Re: Ruby 2.6

#45

Earlier quoted context omitted.

How is it it a security risk to name a constant in source code?

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.

Re: Ruby 2.6

#46

Earlier quoted context omitted.

it can be used to create malicious pull requests that are visually indistinguishable from correct ones

> it can be used to create malicious pull requests that are visually indistinguishable from correct ones If your only check on the correctness of submitted code is visual inspection, you've got a much bigger problem than Unicode confusability.

Do you apply formal verification to your codebases to make sure there are to cleverly-crafted backdoors that still pass all the unit tests? Would be interesting to hear about.

Re: Ruby 2.6

#47

Earlier quoted context omitted.

> it can be used to create malicious pull requests that are visually indistinguishable from correct ones If your only check on the correctness of submitted code is visual inspection, you've got a much bigger problem than Unicode confusability.

How do you check your code? Presumably, you’re not able to exercise the full range of inputs, so at some point you will have to look at the code and figure out what it is doing…

Which means you'd notice the value of a constant being exfiltrated, since a maliciously named constant doesn't magically expose secrets outside of the application.

Re: Ruby 2.6

#48
post #7

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!

Ruby isn't perfect but it's a great utility language and can do a lot of powerful things with very little effort. Read through Eloquent Ruby The only problems I wouldn't go to Ruby for are CPU intensive ones or ones where I need parallel threads (which you already have Java for)

> CPU intensive ones

Truffle Ruby ?

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Ruby 2.6

#49
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.

Re: Ruby 2.6

#50

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?

About your question, the reason is that `===` is aliased to `Range#include?` which checks if the argument is a discrete element contained in the range.

That range of `Date`s does not include any `DateTime`s, so the inclusion check returns false.

`Range#cover?` on the other hand, just uses >= and <= to check .

Post reply on HN