>Rightward assignment statement is added. >fib(10) => x This is exactly the kind of stuff I hated when I had to work with ruby in my last gig and why I will never accept a job using it again - soo many pointless and inconsistent ways to do the same thing ... they have method aliases for collection operations like map/filter in standard library ! .NET went with non-standard SQL-like names (select/where) and I'm not a…
>.NET went with non-standard SQL-like names (select/where) […] Which names do you believe are standard?
`where` is intuitive as a synonym for `filter`, but it's the `select` that always threw me as a synonym for `map`.
I get that they're trying to expose an SQL-like API, but yeah, map is always about mutation, but `select`only does mutation sometimes in SQL.
Much as I would love to believe Ruby 3.0 delivers some kind of speed bump my simple test of doing what Ruby supposedly does best - parsing a log file with a regex - shows Ruby 16% slower than the Python equivalent. Ruby puts IO.foreach('logs1.txt').grep /\b\w{15}\b/ Python from re import compile with open('logs1.txt', 'r') as fh: regex = compile(r'\b\w{15}\b') for line in fh: if regex.search(line): print(line, end=''…
The programs aren't doing the same things. The Ruby one seems to buffer the matches into a huge string then print. Don't know how different it would be but better to compare apples.
So now there are basically no dynamically typed languages left. There's Scheme, JavaScript, what else? All languages nowadays are converging to TypeScript/Rust. It's kind of sad.
Julia, Python, Racket, Ruby, Common Lisp, Erlang, Clojure, etc...
But in my opinion, dynamic typing is a terrible idea for production code.
Am I alone in saying; for some damn reason, I don't like Ruby.. I appreciate what it can do, and indeed what it does.. I just feel like I slipped in between that moment to appreciate it more. I will go and spend some time to learn it more but out of a novelty aspect.. And that makes me feel bad.
Much as I would love to believe Ruby 3.0 delivers some kind of speed bump my simple test of doing what Ruby supposedly does best - parsing a log file with a regex - shows Ruby 16% slower than the Python equivalent. Ruby puts IO.foreach('logs1.txt').grep /\b\w{15}\b/ Python from re import compile with open('logs1.txt', 'r') as fh: regex = compile(r'\b\w{15}\b') for line in fh: if regex.search(line): print(line, end=''…
That's not really surprising since regex in most languages is PCRE and not really indicative of actual interpreter performance.
I'm not sure if Ractor has any real benchmarks yet but it enables genuine parallel Ruby code that communicates through message passing without too much overhead.
>Rightward assignment statement is added. >fib(10) => x This is exactly the kind of stuff I hated when I had to work with ruby in my last gig and why I will never accept a job using it again - soo many pointless and inconsistent ways to do the same thing ... they have method aliases for collection operations like map/filter in standard library ! .NET went with non-standard SQL-like names (select/where) and I'm not a…
But that's what I love about Ruby! There's so many great ways to express logic, making Ruby a language that really rewards exploration. Of course, when working with a team on a production application, you'd set up standards everyone can agree on and understand with rubocop or prettier-rb (which I loathe and will not touch with a 10-foot long pole for my personal projects). That's also great for onboarding newcomers - they can get their feet wet with "standard" ruby at work, and then experiment with it more deeply in their own time, finding themselves in the ways they choose to express their logic. And then, every now and then if you find something really elegant and beautiful in your own exploration, you can introduce it to your team and add it to your team's style if they all agree on it. Between a language that makes all the choices for you, and a language that gives you the freedom to choose how you do things, I'd pick the latter nine times out of ten: at least in the latter, you can restrict yourself from the more wild stuff, but in the former you're forced into a narrow band of choices. I sure didn't ask for right assign, but I'll be trying it out in my personal projects!
I love Ruby and great to see Ruby love on hacker news. Just curious on how popular it is in the hacker news community ?
You know I've long stopped caring about how popular a language is in the community.
As I get older the question I ask myself is do I honestly enjoy using it? If the answer is yes, then I put it in my programming toolbox and ignore the hype.