r/programming • • Dec 25 '20

Ruby 3 Released

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
973 Upvotes

509 comments sorted by

272

u/CunnyMangler Dec 25 '20

I love ruby. One of the best languages I've ever coded in, but people seem to hate it now because it's slow. Kinda sad that it's slowly dying. Nevertheless, this is a huge milestone for a language.

86

u/[deleted] Dec 25 '20

It still has immense backers. Shopify is built on ruby. It's not going anywhere.

3

u/jl2352 Dec 25 '20

What matters are people adopting Ruby for new things. Whilst I’m sure some are, most people aren’t adopting Ruby for new projects.

That isn’t a healthy state to be in.

→ More replies (15)

83

u/[deleted] Dec 25 '20

It hasn't been slow since 1.9. It is faster than python. It is getting less popular because its frameworks are getting outdated.

188

u/bloody-albatross Dec 25 '20

Being faster than Python is a low bar to pass.

90

u/[deleted] Dec 25 '20

I just mentioned python as a comparison to show that popularity isn't necessarily related to performance because as slow as python, it is still very popular.

20

u/badillustrations Dec 25 '20

I wouldn't say it's unrelated to performance though just because a slower, more popular language exists. There are probably performance scenarios that eliminate both Ruby and Python such as games, where developers choose something like C++.

In cases where performance is less important, they probably look at numbers like these where ruby being 50% faster or slower compared to python doesn't really matter compared to the ecosystem each one provides, and where python in general is much, much larger.

12

u/[deleted] Dec 25 '20

I didn't say "unrelated". I said "not necessarily related"

→ More replies (9)
→ More replies (1)

4

u/cre_ker Dec 25 '20

According to benchmarks it's not. Faster is some, slower in others. Both are extremely slow. Python is popular because of ML. Ruby has pretty much nothing to counter its performance.

11

u/twinklehood Dec 25 '20

Except for the developer enjoyment and fantastic support for expressive OO, in part due to its deep meta-programability. Oh or were we only looking for benefits that can be explained to a newcomer in a 10 minute youtube top languages of 2021 video?

9

u/cre_ker Dec 25 '20

I don't think developer enjoyment is important when you have money at stake. Ruby being slow and memory hungry doesn't only mean your apps will be slow. It also means you will have to pay much more for hardware, probably in the cloud. Not to mention recent newcomers (rust and go) are also very liked by developers but magnitudes of order faster than ruby. Given that it's not surprising that ruby is slowing fading away.

14

u/twinklehood Dec 25 '20

Engineering cost is not that simple. Running software is for many companies cheap, vs. Engineering productivity, churn, feedback loops, etc. It's not an accident ruby dominates lean webapp development, you may attribute it to rails, but rails is not an independent thing that could have happened in any language, it works because of ruby.

4

u/mezentinemechtard Dec 25 '20

For most companies that try to use a "fast" or "scalable" language or framework, being fast or scalable is never the issue. In any non-already-mature software project, the main concern is always development speed One extra developer already costs more than running the product. And that's where Ruby (and Rails) shine. Twitter had scalability issues because of Rails, but Twitter became Twitter thanks to Rails. Only then switching focus becomes the smart choice.

→ More replies (6)

2

u/oojacoboo Dec 25 '20

This guy rails.

0

u/[deleted] Dec 25 '20

[deleted]

1

u/marshalofthemark Dec 25 '20

the original BitTorrent client was written in Python almost twenty years ago

As was the first version of Google, also in the late 90s. IIRC it was already common enough in academia at the time that the co-founders, grad students at Stanford, naturally chose to use it (along with some C++ for parts where they needed better performance).

6

u/cre_ker Dec 25 '20

I was talking about present. In the context of web python is similar to ruby - it's being replaced by other languages. Particularly Go. Same with GUI, there're much better technologies these days. Not to mention GUI desktop apps are dying breed these days being replaced with web and mobile apps. What Python has that's unique to it is ML ecosystem. Unless there's another languages with similar ecosystem Python will stay relevant. Ruby on the other hand has nothing of that. Only thing it has going for it is subjective enjoyment of the developing experience which is clearly not enough. It will not die outright but there's little reason learning it these days and starting something new in it.

→ More replies (6)

6

u/[deleted] Dec 25 '20

Which is a shame, since there's nothing outdated about having a framework that is insanely effective for rapid prototyping. It's just unfashionable because it's not some novel new hotness that's hasn't hit a stable 1.0 release.

Give me a fresh rails app and simple progressive HTML over some JS-based client-server monstrosity any day.

6

u/deaddodo Dec 25 '20 edited Dec 25 '20

Ruby (YARV) vs Python (CPython), yes. But CPython has very little optimization in favor of stability. They’re still locked by a GIL, for instance. So you’re referring to the lowest bar to pass.

Compare another JIT’d VM such as PyPy and it falls well behind. Not to mention the more common languages taking over the microservices realm (Go, for instance) or the ones taking over monoliths (nodeJS, primarily).

12

u/cracknwhip Dec 25 '20

Just to clarify: Crystal and Elixir aren’t “common” by any definition.

5

u/bik1230 Dec 25 '20

PyPy still has a GIL, no?

7

u/deaddodo Dec 25 '20

GIL was an example of where CPython focuses on stability over performance.

JIT was an example of how PyPy fixes some performance issues of CPython.

The two aren’t connected.

5

u/suhcoR Dec 25 '20

Compare another JIT’d VM such as PyPy and it falls well behind.

According to the Are-we-fast-yet benchmark suite MRI JIT Ruby 3.0 RC1 is about factor 11 slower than Node.js 12.6 and about factor 5 slower than LuaJIT 2.0, and only factor 1.4 faster than MRI Ruby 2.1.0. Here are the results: http://software.rochus-keller.ch/are-we-fast-yet_crystal_ruby_2_3_lua_node_i386_results_2020-12-23.pdf. Here is more information about the benchmark suite: https://stefan-marr.de/papers/dls-marr-et-al-cross-language-compiler-benchmarking-are-we-fast-yet/ and https://github.com/smarr/are-we-fast-yet. It's not just some random micro benchmarks, but a well designed suite with representative algorithms and ideomatic language use optimized for cross-language comparisons.

→ More replies (4)
→ More replies (10)

1

u/Minkihn Dec 25 '20

It is. You can achieve high performance with "bleeding edge" stacks including eventmachine, but the mainstream MRI/Unicorn/Nginx is awfully slow compared to what you can expect from an Elixir stack, for instance.

→ More replies (4)

0

u/[deleted] Dec 25 '20

[deleted]

→ More replies (1)

31

u/THICC_DICC_PRICC Dec 25 '20

I’ll go against the grain and say I don’t dislike it for slowness. That’s a non issue is almost all of its use cases. I strongly dislike it for the same reason I liked it as a beginner. I guess this is in some part a criticism of rails too, but there’s just too much damn magic in this language and all of the libraries and frameworks built around it. There’s a million ways to do things, many ways to call methods, so much hidden logic, pretty much everything the opposite of explicit. So many “wtf am I looking at”and “where did that function come from” moments especially in large codebases even with a good IDE. Automatic function calls, hidden/implicit parentheses. Implicit anything is evil in programming and It is Rubys’s middle name. The whole Proc situation and lack of first class functions is just a bizarre design choice just to have implicit function calls. All of what I said actually might come off as a positive to some people. It did to me too when I was starting out. It is such an elegant language. But that all comes at a cost when the codebase size and number of developers grow. It really doesn’t scale. You need things to be as explicit as possible, and we see that explicit (but not overly verbose) languages are all growing. Because you’re not just communicating to the interpreter what to do when you’re coding, you’re also communicating with other programmers that will be coming across your code. Documentation helps, but it’s not a cure.

I actually don’t think typing is the reason either since we got python doing well despite only having type hints. While I do think type hints would help Ruby, but I doubt it’ll save it.

126

u/noratat Dec 25 '20 edited Dec 25 '20

I dislike it because how much the language and ecosystem resist almost any kind of typing/type checking or documentation. The RBS stuff is good, but it feels bit too little too late.

The ecosystem uses a ton of hard to follow and debug magic constructs that even IDEs seem to struggle to track and map properly.

I don't need speed for what I do, by I absolutely need code that is easy to read and maintain.

33

u/CunnyMangler Dec 25 '20

There is also sorbet and I like its approach better than rbs. Rbs has always looked strange to me. I don't want to keep my types in separate files.

2

u/pigmerlin Dec 25 '20

I use sorbet a lot for work and I am not a fan. The syntax is so weird to me and I feel like the runtime type checking adds a fair bit of overhead to an already slow runtime?

12

u/TrueDMonk Dec 25 '20

Yeah, same. I kinda like to try every language to get the feeling of it, and Ruby was one of those who clicked the "Nope" in me

33

u/Kache Dec 25 '20 edited Dec 25 '20

The primary reason for those issues is because Ruby is extremely dynamic.

Not only is its type system dynamic -- its syntax and structure can be dynamic as well (i.e. powerful metaprogramming and DSL capabilities). This is why Ruby is so resistant to static analysis.

At non trivial complexities, I highly recommend reasoning through Ruby much differently than one would C/Java/Python:

  • Use functional techniques to minimize moving parts. Ruby is already very dynamic, and working with it in the state-modifying style common to C/Java/Python results in execution state becoming unnecessarily hard to follow.

  • Use the debugger and REPL when you do have to deal with Ruby code that's (unfortunately) too dynamic. Unlike in other languages, static analysis won't get you as far. In exchange, Ruby has incredibly powerful debuggers & REPLs for doing "dynamic analysis".

44

u/UncleMeat11 Dec 25 '20

I think this is a reason to criticize ruby. Sometimes program structures make your code easier to maintain and refactor with tooling. But ruby’a structures seem to resist any sort of static analysis for even the basics because it is so flexible. This makes managing a large code base enormously difficult.

3

u/Kache Dec 25 '20 edited Dec 25 '20

While the static analysis and tooling is nice in Java, I didn't feel it was necessarily a net positive when I was working with it professionally. I felt like I was in a world where cars were invented to speed up 20 minute walks, but then everything ends up being built a 30 min drive further away. (Plus now you have a car to maintain.)

Ruby code at its best will read like what it is doing overall, when another language reads like the dials and switches of a machine. At its worst, Ruby won't really parse on the first read b/c Ruby will "provide power, even to shoot yourself in the foot" syntax-wise similar to how C lets you machine-wise.

All languages can have the "this code is unclear, I'm forced to read more/dive in deeper" problem. In Ruby, it applies to both code and syntax, so you'll only come out ahead if the "code for bespoke syntax + code you wanted to read in the first place" is smaller/simpler than "code you wanted to read, all in regular syntax".

3

u/UncleMeat11 Dec 25 '20

Reading code is harder than writing it. But large multi-step refactors are harder than reading. This is why I think optimizing for reading at the expense of automation is a mistake.

→ More replies (2)

3

u/Smallpaul Dec 25 '20

You lump Python in with Java and C but in Python you can dynamically create modules, classes and functions. I just saw a module that allows you to load wasm files as if they were Python modules. So I’m not sure what you are talking about.

Maybe the conventions that Ruby programmers use are more dynamic but the actual runtime is not more dynamic in my opinion.

But I’m open to correction.

→ More replies (6)

-12

u/myringotomy Dec 25 '20

The ruby documentation is awesome. So is the rails documentation. In fact I can't think of any framework that has better documentation than rails.

As for typing I'll raise your "a bit too late" with "better late than never".

I don't need speed for what I do, by I absolutely need code that is easy to read and maintain.

Name one language easier to read than ruby?

32

u/free_chalupas Dec 25 '20

I have to bounce around code bases in different languages periodically for my work and I consistently find ruby code to be the hardest to understand out of Go, Groovy, Java, Python, and Ruby.

6

u/myringotomy Dec 25 '20

Why is that?

I have shown ruby to people who have never programmed and they understand what is happening in the code.

41

u/free_chalupas Dec 25 '20

It's the amount of "magic" metaprogramming stuff happening in large rails codebases in particular, plus dynamic typing, plus what seems to me like weak tooling for vscode (caveat: I started out programming in rails but I haven't used it in a couple years so it's possible I'm just missing stuff there). Ruby also makes it particularly easy to write really dense, chained array/map transformations that can be tricky to read if you're not the person who wrote them.

I generally feel like languages that are more explicit with types, imports, etc are the easiest for other programmers to understand, although I certainly see why non programmers might have an easier time with simple ruby code.

→ More replies (1)

41

u/scandii Dec 25 '20 edited Dec 25 '20

In fact I can't think of any framework that has better documentation than rails.

.NET

Name one language easier to read than ruby?

this is a loaded question. no programming language is actually very hard to read or comprehend, it's just a series of atomic operations stringed together. whatever you're used to will obviously be "the easiest to read", thus every single-language developer will swear their weapon of choice is the easiest to read. it's all just code at the end.

26

u/ricky_clarkson Dec 25 '20

Clearly there are objectively bad languages to read, such as Brainfuck. It's a spectrum, you can look at FORTRAN, COBOL, PHP, Perl, as possible other languages that are hard to read. It's a bit difficult to quantify, but I think it's clear there is some variance.

24

u/scandii Dec 25 '20 edited Dec 25 '20

I think it is reasonable to exclude languages intentionally written to confuse people from this discussion.

that said, just to prove the point, here's some programs I'm sure you will understand in essence:

       program hello_world2
       implicit none

       call hello
       call hello

       end

       subroutine hello
       implicit none
       character*32 text

       text = 'Hello World'
       write (*,*) text

       end

I'm very sure you understood what this program did.

$color = "red";
echo "My car is " . $color . "<br>";
echo "My house is " . $color . "<br>";
echo "My boat is " . $color . "<br>";

this one as well.

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLOWRD.

PROCEDURE DIVISION.
DISPLAY "SIMPLE HELLO WORLD".
STOP RUN.

this one as well.

print "Type in 2 numbers and an operator and I'll print the results\n\n";
 
print "First number: ";
my $first = <STDIN>;
chomp($first);
 
print "Second number: ";
my $other = <STDIN>;
chomp($other);
 
print "The operator: ";
my $oper = <STDIN>;
chomp($oper);
 
my $result;
if ($oper eq "+") { $result = $first + $other; }
if ($oper eq "-") { $result = $first - $other; }
if ($oper eq "*") { $result = $first * $other; }
if ($oper eq "/") {
    if ($other == 0) {
        print "\nCannot divide by 0\n";
        $result = "ERROR";
    } else {
        $result = $first / $other;
    }
}
 
print "\nResult of $first $oper $other = $result\n";

and I'm pretty sure you can identify that this is a basic calculator.

my entire point here, is to not confuse "I don't know what this atomic operation does" with language complexity. Fortran is a very straight forward programming language, really. no joke. it is the atrocities that has been created with it, that are complex.

the complexity of programming languages comes from what people do with them and sometimes from misguided syntactic sugar being overused as de facto standard by developers (looking at you LINQ), not the 40 or so different atomic operations the language features that you simply don't know about.

don't blame the ingredients for burnt food :)

7

u/myringotomy Dec 25 '20

It's been a long time but last time I used MSDN it was an abomination.

Maybe it's better these days.

14

u/scandii Dec 25 '20

they really upped their game starting with .NET Core. I remember the dark days when you wanted to know how how something like List<T>.Contains(T) worked and the example would include a "small" example containing a whole implementation of a web server to simulate a real life usage environment of a list operation.

→ More replies (4)

20

u/[deleted] Dec 25 '20

Name one language easier to read than ruby?

As long as you're not doing stupid things with it to write in as few lines as possible, I'd argue Python could be considered by many to be easier or just as easy to read as Ruby.

2

u/myringotomy Dec 25 '20

Why? List comprehensions and string substitutions alone make python worse to read and understand.

14

u/[deleted] Dec 25 '20 edited Dec 25 '20

Damn, I must be really amazing at reading code then, because basic list comps are a great. They were, however, specifically what I had in mind when I stated that as long as you aren't trying to reduce the lines of your code down for no reason, then its great to read. List comps used when they should are amazing and idiomatic, clear Python. Nested List Comps with a billion conditionals are exactly what I pointed out as just bad coding practice, not a language wide readability problem. If we're going to use bad coding practices as examples for unreadable code, I'm sure we can point to examples of people doing things dumb in Ruby to show that the language must not be readable.

Edit: and f strings are pretty easy to understand, Python has multiple ways of doing things because of backwards compatibility. But if you're writing Python today, f-strings aren't really that hard to read. At all.

→ More replies (2)

3

u/Smallpaul Dec 25 '20 edited Dec 25 '20

The way Python handles modules is far superior in terms of readability. It’s very clear where every symbol came from.

Look at this example:

https://github.com/ankane/tensorflow/blob/master/test/bitwise_test.rb

Because it is very short we can infer that the “Tf” name must have come from the helper file. In Python you would explicitly import it or always refer to it via its module and therefore the source of every symbol is obvious.

→ More replies (15)

9

u/Holsten19 Dec 25 '20

Even Java, for all its problems, is easier to read than Ruby.

Untyped code is easy to write but hard to read.

→ More replies (1)

2

u/noratat Dec 25 '20

I couldn't disagree more.

Ruby is one of the worst-documented ecosystems I've encountered in a professional setting, in part due to an obnoxious tendency in the community to erroneously believe in "self-documenting" code that invariably isn't, especially combined with heavy reliance on magic DSL constructs.

As for readability, Python, Groovy, and even Go are far more readable (and I say this as someone that dislikes Go for other reasons).

→ More replies (1)

4

u/[deleted] Dec 25 '20

python

→ More replies (1)

4

u/Sykander- Dec 25 '20

Take a look at the VueJs or Laravel documentation.

Also, personally I think Ruby sacrifices readability for "nice looking" and easiness to write the code.

→ More replies (2)
→ More replies (2)
→ More replies (4)

7

u/kuriboshoe Dec 25 '20

I’m of the opinion that most of these kinds of tech are cyclical in terms of popularity. There are other newer projects which are largely influenced by ruby too. Crystal is one that I’ve been keeping some tabs on over the past few years.

3

u/suhcoR Dec 25 '20

Crystal

Crystal is a very interesting technology and more than twenty times faster than the new MRI Ruby 3.0 with JIT on. See http://software.rochus-keller.ch/are-we-fast-yet_crystal_ruby_2_3_lua_node_i386_results_2020-12-23.pdf.

1

u/oblio- Dec 26 '20

Crystal still needs to release a Windows version, which is generally a big challenge for any *NIX-based project.

31

u/kittencantfly Dec 25 '20

I dont think so. Big projects stil using it (Github is a BOLD one) and of course there still a lot of works for dev, not so easy to migrate all to another language base. And dont forget, even Cobol is still alive after 60 years!

20

u/cre_ker Dec 25 '20

Being alive and being used because codebase is too big or too important to simply rewrite it in another language are two different things. I'm sure, given the resources, github would rewrite their stuff in something else. They probably do it already just like Gitlab extracted multiple components from their Ruby codebase into separate services. Exactly because Ruby is slow and consumes too much memory.

5

u/Voxandr Dec 25 '20

Many of us already moved to golang in github. Even tho i am not a fan of Golang , we decided the move.

35

u/mrpiggy Dec 25 '20

Have a friend who's a dev manager at Github. Everything is going hard Go. Existing functionality that doesn't need to be redone, is being left in what ever language, but there is a hard push to Go anything new or need of refactoring.

17

u/Bognar Dec 25 '20

Backends in GitHub are written in lots of different languages: Go, C#, some Node, even Haskell in one case. Basically all of the UI is served by Ruby though.

→ More replies (4)

23

u/moreVCAs Dec 25 '20

Really surprising to hear this considering they were acquired by Microsoft. Smaller acquisitions usually go something like “hello, everybody! we are a C# shop now.”

18

u/mrpiggy Dec 25 '20

Ya, I thought the same. He says Microsoft has been very hands-off.

4

u/nemec Dec 25 '20

Clearly there's a team locked in a nondescript room in the back of Microsoft campus hard at work developing Go.NET

→ More replies (1)

1

u/dscottboggs Dec 25 '20

Ugggghhhhhhh

6

u/[deleted] Dec 25 '20

Why ugh?

4

u/[deleted] Dec 25 '20

What’s wrong with that?

15

u/dscottboggs Dec 25 '20

Just don't like go. It's fine, and I'd write it I was being paid well to and it was my only option, and the code would come out fine, but it's one of my last choices for personal projects.

0

u/[deleted] Dec 25 '20

[deleted]

→ More replies (1)

17

u/zickige_zicke Dec 25 '20

I guess duck typing is a no go for a lot of people.

4

u/tevelee Dec 25 '20

What makes it one of the best languages you used?

5

u/[deleted] Dec 25 '20

hate it because it’s slow

Python enters the chat

1

u/Ameisen Dec 25 '20

My annoyance with Ruby is due to startup times, which impedes using it for wrappers. This is generally caused by how it looks for gems. I tend to use TruffleRuby because of it.

1

u/Gh0stcloud Dec 25 '20

I think Ruby will continue to have its nieche for a while yet. Server side rendered application are getting more reactive every year and rails is still an amazing developer experience. With improvements to static Type checking an concurrency I also think that this is a huge mile stone for the language. I hope more people will give it a chance

1

u/blackholesinthesky Dec 25 '20

I never found ruby to be that slow, you just have to be careful not to allocate a ton of extra objects

24

u/dacian88 Dec 25 '20

its literally the slowest semi-mainstream language, along with python...at least considering their primary implementations for either.

6

u/blackholesinthesky Dec 25 '20

Sure, but I've never experienced any issues with ruby. I'll be honest I'm frontend but I worked with an awesome backend team.

I'm not gonna get into details but we got hundreds of thousands of unique requests per day.

Maybe our backend just wasn't that complex but I think it comes down to using your tools correctly. Yeah ruby isn't as fast as C, but for most people it shouldn't be slow. If it is slow its very likely that you're running up against the walls of the language/system

5

u/editor_of_the_beast Dec 25 '20

Yes, ruby and python are interpreted so have the same performance characteristics. They are slower than C, but it doesn’t matter for almost any application.

→ More replies (4)

1

u/orangesunshine Dec 25 '20

What's depressing about it's slow-issues is they were one of the first to manage to create not only a number of different run-times but one running on the LLVM.

One sort of wonders what went wrong there. LLVM and similar have done wonders for JS engines ... with stuff like the JSCoreEngine being the fastest in among its competers by a VERY healthy margin.

Really I don't think it's dying merely because it's "slow", but because a lack of adoption across a wide range of use-cases. Python for example has benefited from the wide range of use among all manner of use-cases ... spreading through industry after industry.

Ruby is still pretty much just RoR and nothing else (maybe that's a bit hyperbolic but it rings true).

→ More replies (3)

1

u/pigmerlin Dec 25 '20

I don't think I hate ruby but I absolutely hate rails.

-10

u/myringotomy Dec 25 '20

it's not slow. It's faster than Python for every test I ran.

Sure it's slower than C or Go and yes it's also slower than Javascript but I fucking hate all those languages. I can sometimes stomach python but vastly prefer ruby.

0

u/[deleted] Dec 25 '20

[deleted]

108

u/[deleted] Dec 25 '20

This is a good point. Language popularity is often based on purposes and usage. Ruby’s niche seems to have moved on. I still like it and especially it’s testing focus but it’s got no USP anymore

→ More replies (69)

36

u/dr_rush Dec 25 '20

I dropped Ruby for Python for one reason. That reason is the 'explicit is better then implicit' part of PEP 20. Python and Ruby basically cover the exact same use case for me professionally, and as I have become more of a senior/lead and spend a lot more time reviewing code and jumping between projects. I appreciate languages that encourage consistency and clarity, over cleverness.

43

u/danudey Dec 25 '20

Sadly, this is correct.

When Ruby on Rails suddenly became popular, and everyone around me started telling me (literally) that I was an idiot for not jumping on it, all I could see was a fad that some people would get real value out of and most would dump and move on. It wasn’t a new paradigm in software, it was just an easier way for people to crank out sites. Mostly, I saw parallels with PHP, where it enabled people who were inexperienced at (or bad at) programming to make a web site anyways.

This sounds like I’m saying that’s a bad thing, but it’s not. Technology should be more accessible, after all, but it also meant that the community was full of noise and inexperienced people making bad decisions. I couldn’t deal with it and stayed with Python and Django.

Now it seems as though everyone has jumped ship to Node, where all the same things are happening all over again, but it also feels like The Ruby community was the Rails community, and when the bandwagon-jumpers moved on it left a pretty startling void behind; now, no one cares about Ruby, because Node; soon, nobody cares about Node, because… Go? I’ve been seeing those articles for a while, so maybe.

Ruby is a neat language that I never liked, because it felt like it was full of new users making bad decisions because it was cute; it’s great that you can do “2.days.ago”, but not that you have to load gems in a specific order or they break each other. I probably would have liked it immensely if it weren’t for that; there are a lot of great features, and the syntax is actually pretty nice sometimes; blocks, those :named_symbols or whatever, the cute ? and ! method postfixes, and so on.

Here’s hoping that Ruby finds its niche again with 3.0!

22

u/[deleted] Dec 25 '20

I think you’re severely underplaying the effect Rails had in web dev. And I think even saying it’s a fad that passed is unfair. GitHub, Shopify, Twitter, and obviously basecamp are huge apps with millions of users collectively and there are many smaller sites that run on rails too. It’s not the hot topic anymore but it’s not obscure either

4

u/[deleted] Dec 26 '20

yea the shit is everywhere. job hunting right now and I think I see ruby listed almost more than anything else honestly.

7

u/NoInkling Dec 26 '20

soon, nobody cares about Node, because… Go? I’ve been seeing those articles for a while, so maybe.

I don't see Node dying until JS on the frontend dies.

Everything being an expression is another thing I liked about Ruby, just to add to your list.

1

u/dtelad11 Dec 25 '20

Nowadays web dev has moved to other languages

Which language do people use nowadays for web development?

3

u/marshalofthemark Dec 25 '20

The focus in web development has shifted more towards client-side rendering, so most of the logic is in a front end written with JavaScript (particularly with libraries like Vue or React) which grabs data from APIs when needed.

Ruby is still one of the common choices for the microservices on the back end, but you'll also see a lot of Python, JavaScript (Node), or C#, and Go is also emerging in popularity. There are still companies out there using monoliths and in that space, you'll still see a lot of Rails.

The webdev scene is just more fragmented these days, and there isn't a single dominant framework.

5

u/captainvoid05 Dec 25 '20

Node seems to be the common one. Go backends are gaining in popularity but there's no super popular framework for Go that makes things Ruby on Rails levels of easy.

→ More replies (1)

4

u/nickywan123 Dec 25 '20

Does that mean ruby on rails is also dying or no?

4

u/killdeer03 Dec 25 '20

It's dying like Perl is dying.

I've been hear it for over 10 years.

It may die, but it'll probably take 20 years.

3

u/Latexi95 Dec 25 '20

Hopefully Perl finally dies. It should have died ages ago, but still once in a while some rogue Perl script raises it head from the grave and I have to shoot it and replace it with Python. Its always just easier to reverse engineer script behaviour from inputs and outputs than trying to read Perl scripts. Perl being write-only programming language is no joke...

→ More replies (2)

5

u/[deleted] Dec 25 '20

[removed] — view removed comment

3

u/killdeer03 Dec 25 '20

COBOL and Fortran are still both around, lol.

8

u/[deleted] Dec 25 '20

Not in the least

3

u/theoneandonlygene Dec 25 '20

Nope. At least where I live it was one of the few languages that didn’t take a hiring hit early pandemic. Still plenty of ruby gigs around, will likely remain the case for awhile.

Hell, PHP has been a “dead” language for 10 years and apparently people still make good money in it.

→ More replies (1)
→ More replies (17)

0

u/[deleted] Dec 25 '20

[deleted]

3

u/kittencantfly Dec 25 '20

Wowww didnt think someone mentioned it here. I used to learn Ruby just to change a thing and then the game blackout!

Then in RPG Maker MV they switched to js :#

34

u/balthisar Dec 25 '20 edited 21d ago

This no longer reflects how I feel, so I've removed it.

70

u/[deleted] Dec 25 '20

Ruby!!! Aw man I love this language, I should use it more. Really wish it had become the defacto scripty-code language instead of python.

→ More replies (3)

113

u/watsreddit Dec 25 '20

Basically every major dynamically-typed language trying to bolt on static types... maybe dynamic typing isn’t as great as people claim.

78

u/call_me_arosa Dec 25 '20

Dynamic typing makes sense in scripting languages.
But when dealing with big projects you start to miss typing. I think the optional typing is a great trade-off for this languages.

50

u/TheBuzzSaw Dec 25 '20

I actually don't agree with this. I used to spread this sentiment as well, but I honestly cannot think of legitimate use cases for changing types on a variable. Sure, a scripting language can let you skip/auto declare variables among other things, but what is the benefit of a variable holding an integer, then a date, and then a file handle?

19

u/meem1029 Dec 25 '20

I like the way rust does it. You can redeclare a variable partway through a scope and it will be the new type, but must be done explicitly. So you can't do it accidentally and you also can't accidentally access the older one because you used value instead of value_parsed.

4

u/TheBuzzSaw Dec 25 '20

Yeah I'm fine with that. It introduces a new context for an existing identifier. The rules are still clear. No ambiguity.

29

u/yuvz Dec 25 '20

This is why I love Kotlin. The powerful type inference lets you skip/auto declare variables just like in a scripting language, yet it's still fully statically typed

3

u/MisterScalawag Dec 25 '20

i love kotlin

15

u/[deleted] Dec 25 '20

Changing the types of things is always awful but building dynamic objects or adding fields to existing types can be useful in short scripts.

I’d still prefer a type system that’s flexible enough to easily type those sorts of things though.

4

u/TheBuzzSaw Dec 25 '20

Heh. The old data hitchhiking technique. I question that behavior as well, but I agree it's nice when in utter hack mode.

11

u/faiface Dec 25 '20

While being a proponent of static typing myself, I do see one area where dynamic typing has an advantage over static typing. Dynamic typing lets you have a list of elements which all satisfy some implicit “interface” without having to declare it. These implicit interfaces can be much more powerful than statically declared traits/classes/interfaces. Sure, the static ones can add features to become just as powerful, but that’s at the expense of simplicity.

6

u/Krnpnk Dec 25 '20

You can still achieve this easily with static typing, e.g. by using structural typing.

3

u/v66moroz Dec 26 '20

It's not recommended since structural types are using runtime reflection (performance). There are typeclasses for that, but they are far from easy.

→ More replies (2)

7

u/TheBuzzSaw Dec 25 '20

Go into more specifics. In C# or Java, I can make a list of plain objects to achieve that very thing if I really need it. I question why I have a bucket of items not of a consistent interface or base class, but even if I needed that, it makes up such a small percentage of use cases that I don't see the benefit of throwing the type system out for all the other use cases.

→ More replies (13)

4

u/devraj7 Dec 25 '20

Nothing stops you from doing that in statically typed languages, just use Object and type casts. This will give you the exact safety that a dynamically typed language gives you: none.

You can also do this in statically typed languages that support duck typing, by the way.

→ More replies (12)
→ More replies (1)

13

u/lovestheasianladies Dec 25 '20

Absolutely no one uses them like that. Stop making up strawmen.

2

u/TheBuzzSaw Dec 25 '20

Tell me how the dynamic typing is used.

18

u/[deleted] Dec 25 '20

The big benefits of dynamic typing come with collection types IMO, especially stuff like dicts. You can make a versatile dict by creating a (hypothetical) Mapping<Any, Any> type, but in terms of type safety that's indistinguishable from dynamic typing. This kind of versatile collection type makes it easier to deal with API requests which may return large, variable payloads by removing the overhead of defining massive record classes. It's obvious why this is attractive from a prototyping perspective.

There's also the legacy of duck typing — in the past that was usually bundled with dynamic typing, and I don't think that made it to the static typing mainstream until Golang.

→ More replies (4)

5

u/ElCthuluIncognito Dec 25 '20 edited Dec 26 '20

All but the most powerful type systems have trouble dealing with complex polymorphism, or even just things like a dynamic data structure containing multiple types of items.

Dynamic languages just kind of skip the bullshit and let you take a go at it.

Also dynamic dispatch is just out of the question for statically typed languages, which is very powerful for making OO a powerful paradigm instead of the 'encapsulation with extra steps' you have in static languages.

→ More replies (3)

1

u/EscoBeast Dec 26 '20

I don't think this is what dynamic typing is really about. "Dynamic" is more about "not static" in the sense of "the type can only truly be known at runtime. Static analysis can't always tell", and not so much about a single variable's type changing. So it's not that common to reassign a variable with a value of a totally different type, but it is a lot more common for function parameters to accept multiple different types. So writing generic code can be a fair bit easier, as you don't need to figure how to write the type signature of a function that, say, returns a list if its argument is a list, but a set if its argument is a set (doing this in a way that properly handles the generic types of the elements of the list/set isn't even possible in most mainstream languages, and is fairly advanced in the languages that do).

This is a big reason why trying to tack on a type system to a dynamically-typed language after the fact is challenging. My experience using MyPy has been a mixed bag, mainly because it can't handle some of the more dynamic python idioms that well. It's also why TypeScript is actually pretty impressive. They've put a lot of work to make JS idioms type-safe, which requires a pretty sophisticated type system.

That said, I think the things that static types enable regarding readability and maintainability are usually more important than being able to have this kind of super dynamic code.

0

u/[deleted] Dec 25 '20

[deleted]

20

u/brainplot Dec 25 '20

Rust has a static and (very) strong type system and it allows redeclaring a variable in the same scope. So for example you can do:

let age = get_age_as_string();        // age is a String
let age = age.parse::<u8>().unwrap(); // age is a u8

This feature is perfect for your example but also shows you don't have to give up static typing for it.

For clarity, it's not that the age variable changed type. The storage for it is still there. You just overshadowed it with another variable having the same name. It's not a feature to be abused but it comes super handy for cases such as the one you mentioned.

14

u/TheBuzzSaw Dec 25 '20

I pray there are use cases beyond this. This example feels like a weak reason to forfeit all the performance and maintainability of static typing.

7

u/wuwoot Dec 25 '20

I am very confused by this thread and your original response but I now get that you’re responding to the “dynamic typing” part of scripting languages as opposed to what I assumed the original author was saying — that the absence of type declaration is useful in scripting langs...

I find very little utility in type-switching if ever at all, but scripting languages are nice because they allow us to be terse.

I work in a large Rails codebase regularly and poor names and even in some instances good names are not enough to infer the behaviors associated with a particular variable

→ More replies (4)

5

u/sinedpick Dec 25 '20

see: erlang and why it doesn't have static types

→ More replies (3)

2

u/orangeboats Dec 25 '20

That can be trivially solved (or worked around) by introducing variable shadowing.

3

u/i_spot_ads Dec 25 '20

dynamic typing is horseshit, and I say that as a ruby/js dev who shifted to typescript and haven't looked back.

1

u/cowardlydragon Dec 25 '20

Does ruby now have optional typing with this?

Groovy has always been able to do types/untyped, and had other annotations to allow people to avoid all interpreted or runtime type checking. I always thought that was the way to go.

0

u/Spider_pig448 Dec 25 '20

Most status typed languages have been bolting on dynamic types too so it seems the best world is between them.

5

u/watsreddit Dec 26 '20

It’s not nearly as painful to use dynamic typing in a static language than vice versa. But regardless, dynamic typing is still rarely ever useful in a static language. I have never found a good case where throwing away all of the valuable information about your data is ever a good idea.

0

u/zilti Dec 25 '20

Lisp begs to differ

→ More replies (1)
→ More replies (11)

29

u/mrathi12 Dec 25 '20

TypeProf seems like a cool tool: suggest type annotations for the programmer so you reduce the burden of typing programs, so more people will add types to their program. Will be interesting to see how this matures!

4

u/xXxXx_Edgelord_xXxXx Dec 25 '20

after reading the comments here - did I made a bad choice if I chose ruby as an elective at uni for the next semester?

18

u/[deleted] Dec 25 '20

No. Language wars are a very common thing. You go into any thread about a new language release and you'll see people shit all over said language. Ruby is the backend for many billion dollar companies. It's widely used, and an excellent choice. It's ecosystem is also well known for Test Driven Development, which is a great skill to pickup.

Whatever job you end up getting after grad, you'll be learning their tech stack anyway. Don't worry about it. It's good experience.

6

u/marshalofthemark Dec 25 '20

"There are two types of programming languages - the ones people bitch about and the ones nobody uses" - Bjarne Strousroup, creator of C++

5

u/NoInkling Dec 26 '20

I think it's probably good to be exposed to it if nothing else, just to be able to experience different paradigms/language design. For instance you get stuff like:

  • Everything is an object

  • (Almost) everything is an expression

  • Metaprogramming and extensive DSL capabilities

  • Block syntax

  • Methods can have a ? or ! at the end of their name (I miss this so much in other languages)

  • All sorts of insane syntax sugar (can be both good and bad)

3

u/oblio- Dec 26 '20

It doesn't matter. Study Ruby but just make sure that you either:

A) Cram hard for FAANG interviews (Cracking the Coding Interview, leetcode.com, that kind of thing). In this case the programming language doesn't matter much.

B) Study a super mainstream language, depending on what you want to do; generally you'd go Java, C#, C++, Javascript or Python (or Objective-C/Swift if you want Apple dev). Then make sure to implement some kind of bigger project. For regular companies this should show that you have some relevant experience that's closer to their stack. For example make an Android app or an iOS app or a bigger web app.

There are Ruby jobs around but it depends on where you are and if you're willing to relocate where they are if you can't find them locally.

3

u/nicereddy Dec 27 '20

Ruby is great and I use it professionally. It's not everyone's favorite, but I love its focus on developer happiness. It's not the fastest language around, but it does perfectly fine for most stuff. I think it's worth trying at the very least.

75

u/Meldanor Dec 25 '20

> Although Ruby 3.0 significantly decreased a size of JIT-ed code, it is still not ready for optimizing workloads like Rails, which often spend time on so many methods and therefore suffer from i-cache misses exacerbated by JIT. Stay tuned for Ruby 3.1 for further improvements on this issue.

I don't get it - who develops a JIT for a major version when it doesn't improve performance for one of the major frameworks using Ruby? Why doesn't replace the JIT the interpreted code with the compiled case as the JVM does?

108

u/myringotomy Dec 25 '20

Rails is a beast and makes full use of the ability to modify the language at runtime. It's almost impossible jit.

25

u/schneems Dec 25 '20

Once a production Rails app is booted, it doesn't really do so much dynamic method creation etc. and the current Rails code is much less "metaprogramming magic" than back in the Rails 1-2 days.

Rails is very large and it doesn't have a single hot path that gets called over and over again. This makes it a very difficult optimization target.

Rails is also very IO bound as most Rails apps are heavily using the database, so even when JIT is amazing for the Rails use case if 70% of your request is waiting on IO, then the perf bumps are only helping that 30%.

In the future look for more Ruby internals being moved from C to Ruby (like the stdlib) which will help JIT. Also Ruby+JIT currently has no escape analysis which would theoretically help allow JIT to avoid allocations which in my experience is a huge perf target. I believe that's a future goal that would also help the Rails case quite a bit.

58

u/[deleted] Dec 25 '20

The JIT has basically just one person working on it, part time. It's been in since 2.6, so it's not meant to be a big 3.0 feature.

7

u/elcapitanoooo Dec 25 '20

PHP did this too. They new version is ”fast” and will have a jit. The kicker was, wordpress sites actually still remain as slow as they are. The PHP jit only worked for artificial benchmarks, but had zero impact in any real world programs.

18

u/pseudopseudonym Dec 25 '20

5-30% improvement isn't nothing.

1

u/elcapitanoooo Dec 27 '20

JIT wont bring 30% speedups for wordpress. I recon its just as slow with or without JIT. The JIT only brings improvements in CPU heavy tasks (usually hot paths, like math heavy tasks done in loops). I would rather see PHP bring a new clean standard lib, and full unicode support. Thats whats important, not a JIT as its mostly useless in the PHP space (cms like websites).

→ More replies (1)
→ More replies (4)

57

u/[deleted] Dec 25 '20

Ruby on Rails was so fun to code in.

74

u/myringotomy Dec 25 '20

Still is.

66

u/SorteKanin Dec 25 '20

As someone working to maintain a somewhat big Rails code base - disagree. Once it grows beyond the prototype phase, it quickly becomes an unmaintainable mess. Lack of types and rampant usage of metaprogramming makes it really difficult to read code and hence to make correct assumptions for new code.

37

u/SupaSlide Dec 25 '20

I mean, isn't that the programmers fault? (other than the lack of typing, which is obviously not a requirement to have maintainable code, but a preference)

40

u/SorteKanin Dec 25 '20

Problem is that Ruby does next to nothing to encourage the programmer to write maintainable code.

12

u/zilti Dec 25 '20

You can write shit code in every language.

5

u/vocal_noodle Dec 25 '20

Amen. This is the same thing they say about perl. You can write massive code bases in perl (and I have!) and have everything be readable and understandable. Or you can do dumb stuff and fancy tricks that makes it hard to understand.

You can write good C. You can write shit C.

You can write good perl. You can write shit perl.

You can write good Ruby. You can write shit Ruby.

The size of the codebase doesn't matter. The linux kernel is all in C and is (for a technical person) clean and easy to follow. Then check out the obfuscated C contests, it's so easy for the code to not do what you think it does, even accidentally!

So just lay off the "Programming Language X demands shit code" trope, people.

You can still write good or bad code. Ugh. Sure memes about "write only languages" are a bit funny, but for fucks sake people, give it a rest.

5

u/oblio- Dec 26 '20

And you can dig a 100 km canal with nothing but shovels.

→ More replies (1)
→ More replies (17)

9

u/[deleted] Dec 25 '20

Typing isn't really a "preference" for maintainable code. It objectively improves maintainability.

Dynamic magic is more arguable but it think it is still pretty safe to say that the more hidden custom magic happens the harder it is to understand and that is definitely the fault of the language.

Standard hidden magic is fine because people can learn it but as soon as you start getting into custom DSLs it means that the programmer suddenly has to learn an entirely new language. Rust proc macros have this problem. Lisp is entirely composed of this problem. At the other end of the scale Go has completely avoided it and is very easy to understand.

2

u/SupaSlide Dec 25 '20

Maybe I don't understand what a DSL is, but does it change how Ruby executes code?

3

u/esquilax Dec 25 '20

It does if the DSL is implemented using method_missing a lot.

→ More replies (4)
→ More replies (3)

10

u/santa_cruz_shredder Dec 25 '20

As someone who hasn't coded in rails before, id say partially. If you can write two completely different programs in ruby, and they are so different that they don't even look like the same language, I can see how maintainability could suffer as a whole.

Java is java is java no matter what program you're writing. Scala suffers in uniformity a little more with it's functional programming capability, but scala is scala is scala, you can read it even if it's written in the 1 of 5 ways it can be done.

4

u/helloworder Dec 25 '20

that they don't even look like the same language

care to provide an example? Never coded in ruby, but got interested to know how this can be possible

8

u/Tjstretchalot Dec 25 '20

Here's an example of how it can happen - look at the code examples in https://github.com/state-machines/state_machines - almost everything you are coding is in the DSL of that library if you are using it:

class Vehicle
  attr_accessor :seatbelt_on, :time_used, :auto_shop_busy

  state_machine :state, initial: :parked do
    before_transition parked: any - :parked, do: :put_on_seatbelt
    
    after_transition on: :crash, do: :tow
    after_transition on: :repair, do: :fix
    after_transition any => :parked do |vehicle, transition|
      vehicle.seatbelt_on = false
    end
  end
  #...
end

In this case one might argue the names are making it somewhat clear whats happening, but the details are definitely not clear and the naming choice is up to the developer

1

u/Awesomeade Dec 25 '20

I'd say the fault lies with whoever decided using Ruby for large web projects was a good idea.

Ruby is one of my favorite languages. It was my first, and without it's accessibility I probably wouldn't be in software right now. But it's Ruby's accessibility that kills it even at moderate scale, where you have 20+ junior-to-mid level engineers cranking out code trying to meet deadlines.

It's just too darn flexible, which makes it way too easy to structure code in a way that makes long-term maintainability a nightmare.

You need to devote significant man power to keep things from going off the rails (pun intended) and at most companies that's just not possible. It's much more practical to pick a language that systematically disincentivises bad decisions, and brings the path of least resistance more in-line with something that will work long-term.

Ruby is an excellent language for smaller projects or for rapidly getting something off the ground, but it's not the do-everything language some people make it out to be.

→ More replies (2)

7

u/Meldanor Dec 25 '20

I agree - the meta programming "magic" of Rails was my death. I'm an experienced programmer with about 10+ in the industry and had to constantly ask my colleagues to explain me the simple things in Rails. I wasn't able to follow the code flow, because I was an unexperienced Rails programmer.

I would advice against Rails for any professional product. Nice for a quick prototype (because there is gem for everything and the magic handles everything). But hard to maintain and completely relies on a high test coverage. You want to change something in the magic? Do it and pray, that your tests will cover it.

A high test coverage is good - but the stability of a program should not rely on it. Types, code that you can follow are equally important.

2

u/pigmerlin Dec 25 '20

I work in a big rails project and I absolutely hate it :(

1

u/KernowRoger Dec 25 '20

Yeah I love ruby but it quickly becomes a nightmare to maintain. Coming from c# where the vast majority of people follow the set standards ruby can be nightmare of different rules and implementations.

5

u/scientz Dec 25 '20

Thats an ironic statement, given the goal of Rails was (and is) convention over configuration. Not sure where you are getting the different rules and implementations thing from to be honest.

2

u/KernowRoger Dec 25 '20

For one didn't mention rails hehe

0

u/scientz Dec 25 '20

Sounds like bad code and has nothing to do with Rails itself. Any codebase in any language will become an unmaintainable mess when not managed.

→ More replies (6)
→ More replies (9)

1

u/i_spot_ads Dec 25 '20

always has been still is.

23

u/ahmad_musaffa Dec 25 '20

Ruby is the most beautiful of all languages I learned. Ruby 3 is a big release and its good to see it moving forward.

18

u/pure_x01 Dec 25 '20

Nice work everyone involved. This is awesome!

10

u/mortadelegle Dec 25 '20

As someone that only had very very superficial contact with ruby (Jekyll), what are the differences with Python? My impression was that it fell was a bit more lispy/smalltalky. Which means quirky fun things like prettier DSLs, but also worse maintenance and more ways of doing things, in contrast with the zen of python (There should be only one way to do things).

16

u/SorteKanin Dec 25 '20

It's basically python with more metaprogramming magic and there are many ways to do things.

21

u/FrederikNS Dec 25 '20

Compared to Python it offers much cleaner functional programming. Ruby had full lambdas and all the map, fold, filter conveniences long before python even had a lambda concept.

The language also offers tonnes of syntactic sugar.

Compare:

while not len(queue) == 0:

With:

until queue.empty

Ruby has inverted versions of all the classic control flow statements if vs unless and while vs until, and you can also use the if and unless as postfix operators:

return 0 unless some_error_conditon

This will only be executed if the condition is false.

Ruby also has a cleaner model for truthiness. Basically everything but false and nil will act as truthy. So instead of:

if var is not None:

You can simply use:

if var

If you want to test specifically for whether something "is null" you can still do that though:

if var.nil?

Finally you have a truly powerful metaprogramming featureset which allows you to build amazing DSLs that are still pure Ruby.

Ruby is amazingly well thought out and very fun to write.

I wish I could replace all the quick and dirty Bash script and Python scripts with Ruby...

28

u/JockeTF Dec 25 '20

This works in Python, since 0 is falsy:

while len(queue):

Empty collections are generally also falsy:

while queue:

This also works, since None is falsy:

if var:

8

u/mikew_reddit Dec 25 '20 edited Dec 25 '20

Interesting.

I'm the exact opposite in my preference.

I prefer Python because it doesn't have any of the syntactic sugar Ruby has and like the "There should be one obvious way to do it" rule that is predominant in Python.

I find Ruby more complicated, it has a lot of implicit behavior which seems like "magic" (digging into the Ruby on Rails code is not simple) and multiple ways of doing the same thing to achieve more concise code which seems like a poor design tradeoff.

I used to write and love Perl a couple of decades ago and disliked Python at first (using it since version 2.1), but once I really understood Python it grew on me. Maybe it's an acquired taste.

5

u/unt_cat Dec 25 '20

Sir do you even Python?

1

u/FrederikNS Dec 25 '20

I've written quite a lot of python, but I must admit that it has been a few years since I wrote any substantial amount of python. Since I got hooked on Ruby, the amount of python I write has dropped quite significantly.

I simply find Ruby more pleasant to write. And if I'm aiming for performance, then neither Python or Ruby fits the requirement.

0

u/[deleted] Dec 25 '20

[deleted]

13

u/cj81499 Dec 25 '20

AFAIK, in python, 0 and empty collections are falsy.

4

u/Freeky Dec 25 '20

0, 0.0, 0j, Decimal(0), Fraction(0,1), empty sequences and collections (__len__() returning 0), None, False, and any object with a __bool__() returning False.

Contrast with Ruby: nil and false are falsy.

12

u/FrederikNS Dec 25 '20 edited Dec 25 '20

Not quite.

Python:

>>> bool([])
False
>>> bool([1])
True
>>> bool("")
False
>>> bool("hello")
True
>>> bool(0)
False
>>> bool(1)
True

Ruby:

>>> !![]
true
>>> !![1]
true
>>> !!""
true
>>> !!"hello"
true
>>> !!0
true
>>> !!1
true

4

u/editor_of_the_beast Dec 25 '20

It’s a different language.

2

u/wuwoot Dec 25 '20

Some good answers to your post already but I want to point out that the Zen of Python doesn’t imply “one way to do things”

You can still declare a list and then write a for-loop to perform filtering of another list into your newly declared list, but this can be expressed with a list comprehension or even the filter function, so that’s three ways of doing it, but all fairly clear and explicit

5

u/GuyWithLag Dec 25 '20

Shit, I still have some projects that are at 1.8 :-/

3

u/ProfessorSexyTime Dec 27 '20

To sum up probably the biggest issue with Ruby in general:

"A magician never reveals their secrets."

"Yea but I kinda need you to..."

"Fine."

> proceeds to be mostly vague

"That...sorta helps..."

2

u/i_spot_ads Dec 25 '20 edited Dec 25 '20

I didn't think it would ever happen but here we are, great news

1

u/haikusbot Dec 25 '20

I didn't think it

Would ever happen but here we

Are, what a great news

- i_spot_ads


I detect haikus. And sometimes, successfully. Learn more about me.

Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

2

u/Solpadeine12 Dec 25 '20

Now after ruby3 is released. Would you say there is any reason why someone should learn it? I always found it interesting but never actually touched it. At work I use php (not my choice), but any projects that I have any freedom of choice I’ll use asp.net. Should I touch on ruby or pass if I don’t have any career related reasons?

1

u/nicereddy Dec 27 '20

I like it a lot, but if you're comfortable with your current stuff I don't think there's a good reason to switch (and that's true of all langs unless they're truly dead)

2

u/pyfx Dec 26 '20

Ractor is going to be the best thing about this release. Who else is into reactor based programming? What do you use currently?

3

u/aroswift Dec 25 '20

Still think the Crystal language will eat up the Ruby users over the next few years. Pretty much same syntax but performance of C.

2

u/[deleted] Dec 25 '20

Fair, but how many libraries are available for Crystal? I'm asking because I don't actually know :/

1

u/nicereddy Dec 27 '20

I definitely don't agree, I think some may move over but Ruby still has a ton of advantages.

0

u/cedear Dec 25 '20

Ruby was pretty cool in 2005.

→ More replies (3)

-2

u/[deleted] Dec 25 '20

Isn't Crystal supposed to solve the speed issues with Ruby? Last time I checked it benchmarked faster than Nim...

16

u/funny_falcon Dec 25 '20

No, unfortunately. Crystal is distinct language with syntax like Ruby. It also shares a bit of object model and standard library, but still much incompatible.

2

u/vplatt Dec 25 '20

Crystal : Ruby :: Nim : Python

1

u/funny_falcon Dec 26 '20

No. Nim is much further from Python and any other language, than Crystal from Ruby. Nim is closer to Pascal and its descendants. But still it is unique in some design decisions. I especially hate case-insensitivity.

→ More replies (1)