Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typechecking, deep data type exploration, jumping to definitions and implementations? I really think it's a bad choice of Ruby not to care for types. And well we now have Crystal which again makes me question why Ruby? And it’s a shame no language is as beautiful as Ruby, not in features choices, design elegance, balance, beauty of the syntax, joy of programming mindset, not even in the name and logo. I wished Matz rethinked this part.
pansa2 · 59s ago
> it’s a shame no language is as beautiful as Ruby [...] I really think it's a bad choice of Ruby not to care for types
Do you think Ruby could change something so fundamental as dynamic => static typing and still retain its beauty?
The only static typing solution I've seen for Ruby is Sorbet, and it's... not beautiful.
frou_dh · 1h ago
Static type-signatures are inevitable in general. You can see this by how even the Ruby documentation has to make up silly ad hoc notation like "→ array_of_strings", "→ matchdata or nil" etc.
As someone coming from Ruby to TypeScript, I find types cumbersome, verbose, complex, and not of much use. I have been writing and reading TS for the past six months. What am I missing?
jemiluv8 · 4m ago
Typescript is not suitable for all applications. I also transitioned to Typescript from python some years ago and the extra information about "intent" provided by types made a world of difference to me when reading code written by other people. Type information is so valuable in a team of 3+ developers and when a rest api has at least 5+ resources. If your application or team size are any less, the benefits of typescript might not be obvious. I think that could be what you're experiencing.
In a team, it is just so much easier to come across a "typed" function as opposed to an untyped one. You need to read the entire function to know what it is about.
thaneross · 7m ago
If your only exposure to static typing is six months of TS, what you are missing is experience. You're still on the learning curve and thus the cognitive load of explicit types is high, but with time the opposite becomes true.
nchmy · 14m ago
I've only used TS a bit, but I find the typing (and everything else) to be vastly more difficult/convoluted than in Go. Though, using Deno does help a lot (not necessarily with typing though).
theshrike79 · 2h ago
LSP (Language Server Protocol) was the final nail in the coffin of Emacs for me.
VSCode was "good enough" for pretty much every language with LSP at that point, I did't even bother with Jetbrains ides outside of work after that.
And when Obsidian replaced org-mode for me, I deleted my .emacs directory from my dotfiles repository.
themafia · 1h ago
> LSP (Language Server Protocol) was the final nail in the coffin of Emacs for me.
It was the opposite for me. Emacs + LSP + many other common conveniences all bind together so beautifully and efficiently that I can't imagine using any other IDE at this point.
zkry · 59m ago
And I have to say that the whole trope of "Emacs may be able to do anything but you have to configure a lot to get it to work" has has got to be pure exaggeration at this point with things like eglot. I had the most painless experience setting up LSP for Java (among many others).
austinjp · 1h ago
Indeed. I'm a long time Emacs user (emacs-nox in the terminal). After spending a day getting LSP and eglot working, I'm loving the "IDE" experience. Reliable indentation, auto-complete, intelligent var renaming, real-time(ish) warnings and error messages, etc, all the good stuff. I'd been ignoring IDE features in Emacs for years, thinking I didn't need them, but I have to admit they're a luxury I don't want to give up.
writebetterc · 1h ago
Same, Emacs is improving at a rapid rate thanks to its adoption of LSP and Tree-Sitter. Performance is very good, but the async story needs to become better.
javaunsafe2019 · 2h ago
Fully agree. Had to work in the past with ruby. Loved it but type errors during runtime where a thing and therefore I would never use ruby in production again.
I use kotlin nowadays…
koakuma-chan · 1h ago
I used Kotlin before it was popular and people laughed at me... And now I use TypeScript...
maccard · 29m ago
Kotlin is lovely to work with but holy hell is it slow to iterate on.
arunix · 26m ago
What does "slow to iterate on" mean?
zarzavat · 2h ago
This was always true, to be honest. Statically typed languages have always been better. Free IDEs such as Eclipse have been available for a long time. Good JVM languages such as Scala have been available for a long time.
If only the Ruby ecosystem had adopted Scala instead of Ruby, with cutesy books and eccentric underscored personalities, history might have been different.
agentcoops · 52m ago
I’m honestly still stunned at the self-implosion of the Scala community… can’t think of any other language that threw away such quite unexpected success at an industry level. Apart from the toxic community, not trying to challenge Python for supremacy in the scientific computing/data analysis space seems like the major mistake, given it was for a time the lingua franca of data infra (Spark, Scalding etc).
Ruby is such an elegant language, but the strong and ongoing hostility to any sort of sensible gradual typing is a real mistake.
I know that the Ruby community loves its clever runtime metaprogramming, but even the most metaprogrammed codebase is still going to consist mostly of plain old in-out methods. And as anyone who's ever typed a dynamic codebase knows, you pick up so much low-hanging fruit, in terms of edge cases and errors, when you slap some types on those. You don't need to type everything, but there is real hostility in Ruby circles to gradual typing, even where it would make sense and wouldn't impose any major costs.
Personally, I've stopped writing Ruby. Short of any pathway to sensible gradual typing, I just can't shake the feeling that every new line of Ruby is instant tech debt. Which is such a shame, since I find real beauty in the language.
nromiun · 1h ago
> Python is not my favorite programming language. In fact, allow me to drop the euphemism and express my pure, unadulterated thoughts about it: I never liked Python, I see it as a huge red flag and I think the world would be a better place if we all decided to finally move on from it.
Why do people make hating a tool their entire personality? I have noticed this same thing with languages like Go ("oh no Go still bad") and C++. I don't like C++ myself but I don't hate it. It would be like hating a screwdriver.
If you don't like a language simply don't use it, there are hundreds of alternatives. If your employer is making you write in that language you should hate your employer, not the language.
mcdonje · 55m ago
You left out this part:
> The reasons behind this choice of employment are very much unrelated to the technology stack.
Programming language isn't the only factor for employment. People don't always get to just change jobs when an aspect isn't ideal for them.
On top of that, python is ubiquitous in some sectors. It's not as easy to avoid as a lot of other languages.
hecturchi · 1h ago
For internet points!
frumiousirc · 45m ago
> It would be like hating a screwdriver.
I hate Philips screwdrivers (but love JIS).
k__ · 1h ago
Especially strong from someone using Ruby, which is basically Hipster-Python.
/s
benrutter · 2h ago
I'm a python developer, and a big fan of the features with gradual typing etc. This article really highlights for me though, how python has very much changed from the language it was even 5 years ago.
Initially, the celebrated feature of python was that it allowed easy and fast development for newcomers. There was a joke a long the lines, "I learned python, it was a great weekend".
As much as I like python's type system (and wouldn't want to see them ever go way!), part of me wonders if moving into a world where hello-world can look like this, is a world where python is no longer the "lean in a weekend" language:
from typing import Annotated
import typer
app = typer.Typer()
@app.command()
def main(
name: Annotated[str, typer.Option("--name", "-n")],
) -> None:
"""Prints out 'HELLO {name}!!' (name upper cased) to the console"""
print(f"HELLO {name:upper}!!")
if __name__ == "__name__":
app()
(obviously the example is silly, and I know this is a lot more than you need to do, hopefully you get my point though!)
wraptile · 59m ago
Agree but fortunately Python's types are entirely optional!
I'm very familiar with pyright and still I start most of my new projects without types and start sprinkling them in once I have a good base working already. This works so well that every time I pick up a static language I just get turned off by the friction of mandatory types and go back to Python. The only exception is Typescript where I can just Any everything temporarily as well.
lofties · 1h ago
Personally, I would absolutely not mind it if Python made type annotations required.
maleldil · 55m ago
I use pyright with typeCheckingMode: strict and enforce that via checks in CI. You still have the Any/type: ignore escape hatches when necessary. I haven't written fully dynamic Python in years.
blubber · 1h ago
You're going to love the equivalent Haskell example.
Daishiman · 1h ago
All due respect but Typer looks like the kind of library that you want to use after your CLI has enough args that you wouldn't be able to get away with the sort of "Hello World" simplicity that you pine for.
Nobody's stopping you from manually parsing a couple of arguments. I still do it all the time and it's OK. If anything the magic of gradual typing is that you get to use it as necessity arises.
maleldil · 54m ago
Typer is very convenient. I don't believe anyone manually parses arguments manually in Python where we have argparse in the standard library, and Typer is a step forward from that.
melvinroest · 3h ago
This post reminds me of something.
During my first Introduction to Programming course at university, I was taught Java. One thing that I found very troubling is that it wasn't easy, or possible in many cases, to change the programming language. Sure, you can write new functions or methods or classes, but I can't change the keyword for an if-statement. I also remember the TA saying "why would you want that?" I caught myself thinking "if we can program a computer, then why can't we program a language?"
15 years later, I still have this issue a bit, except I made my peace with it. It is what it is. There are some exceptions though! Such as: Lisp, Smalltalk and similar languages. It's in part why I have worked for a company that professionally programmed in Pharo (a Smalltalk descendant [2]). I remember hacking a very crude way for runtime type checking in Pharo [1], just for fun.
I'm not a Ruby programmer, all I know is that Ruby has some things that are identical to Smalltalk. But my question to the author would be: if you long for things like keyword arguments, type hints and namespaces why don't you program it in the Ruby language yourself?
Or is that really hard, like most other languages?
[2] Fun fact, I learned about Lisp, Smalltalk and Pharo through HN! So I know most of you know but I suspect some don't.
lmm · 3h ago
The language is the easy part. Getting tool support for your language change is the hard part. Getting the library ecosystem to adopt it is even harder.
I think that's why extremely flexible languages have seen limited adoption - if your language is more of a language construction kit where everyone can implement their own functionality, everyone has to implement their own tool support (or, more likely, live without any) and there's a limit to how far you can go with that. The best languages find the sweet spot where they give you enough flexibility to implement most reasonable programs, but are still constrained enough that tools can understand and work with all possible code.
dale_glass · 3h ago
Too much change isn't good though. There's value in consistent basics. I've seen people doing things like:
#define BEGIN {
#define END }
because they liked Pascal, and that way lies madness.
zelphirkalt · 3h ago
Lets not equate silly and possibly dysfunctional string substitution macros with macros in higher level languages, which let you inspect and act according to the structure of the AST.
Ygg2 · 2h ago
> that way lies madness.
Flashbacks to scala operator PTSD.
No. I don't want to use ++<>^^%% operator! I am not a number! I'm a man!
KolmogorovComp · 1h ago
Scala3 fortunately fixed those.
zelphirkalt · 3h ago
> I also remember the TA saying "why would you want that?"
Is a typical response of someone without the background and without the imagination. It may well be, that doing Java-only for too long robs one of both. An alternative response could have been: "What a fascinating idea! How would you apply that? / What would you do with that?"
I am happy for you, that you found the exceptions and that your picture of the computer programming world is not as incomplete and bleak as that of the TA back then.
sfn42 · 2h ago
So your suggestion to the TA is to ask literally the exact same question but slightly different?
jibal · 1h ago
One question is encouraging, the other is discouraging. That matters a lot in an educational setting.
And they aren't the exact same question.
cess11 · 1h ago
There is metaprogramming support in Java, but it's not as inviting and friendly as hygienic macros or Ruby patching. The obvious example is reflection, with which you can do a lot of bizarre things, some of which are useful sometimes. Another is annotations, which is heavily used by libraries in a way similar to how macros are used in certain Lisp like languages.
While you rarely see byte code shenanigans in Java code bases, it's how some other languages on the JVM achieve things like runtime metaprogramming.
manuelfcreis · 3h ago
I fully agree to the points here, even as a full time ruby lover. Jumping around different languages over the past 10 years really shows staleness in Ruby as a language, even if the ecosystem tries to keep up.
The ergonomics of ruby still have me very much liking the language as it fits how I think, but there are a lot of good developments in the usual neighbors, and I see myself picking up both Python and JS ever more for small projects.
khoury · 2h ago
Ruby fully typed would be awesome imo, but I know that goes against a lot of the fundamentals in the language. I just like the syntax and expressiveness of it, but coming from typescript, its just such a bad DX having to work in a large Ruby codebase.
ckdot · 1h ago
Typescript is a workaround.
It exists because web apps got more complex and browsers only support JavaScript.
So developers need to stick to JavaScript, but they need typing, therefore TypeScript has been implemented.
It’s an exception where it made sense to do so. For all other languages: if you use some dynamic language and you need typing, either wait until the language supports types natively (PHP‘s approach) or „just“ change the language.
The additional complexity of an additional typing layer is huge. The complexity of TypeScript - and in general JavaScript‘s ecosystem - is incredibly huge.
The biggest issue we have in software development is not that a language isn’t elegant, or you can’t write some some in 3 instead of 15 lines… the biggest problem is complexity. Developers too often forget about that. They focus on things that don’t matter. Ruby vs Python? It doesn’t make a real difference for web apps.
If you want a language and ecosystem with low complexity try Go. It’s not perfect. It’s not elegant. Or PHP, which has a lot of drawbacks, but overall less complexity. I don’t say Go or PHP are the best languages out there, but you should try them to get a picture - to decide for yourself what’s important and what not.
jemiluv8 · 11m ago
This reads like a love letter to programming languages. You can never truly talk
about the quirks of a language without dabbling in it. And without experience with other languages - I doubt some of these quirks might even be seen as such.
Error handling for instance has always been my pet peeve. With dynamic languages like python, errors were all "exceptions". But then golang came along and decided
they'd be values and that only the truly exceptional errors should be "panicked".
But the if err != nil syntax became super verbose only after I learned about the
Result<Ok, Err> from Rust and the matching syntax associated with it.
A lot of people are shocked when they learn about ruby's monkey patching. I for one never truly groked the packaging of python applications until uv came along
to deliver an experience similar to npm.
And I agree, Typescript is the state of the art as far as static typing on top of a dynamic language is concerned. But I never considered it a programming language.
More like a tool to assist developers write/manage large javascript code.
In the end, I think the true reason for returning to pythong probably had more to do with getting a python gig. I live in the part of the world where my tech stack
ended up being influenced early on by the places I worked. I didn't mind learning Typescript for my first gig or improving my skills with nodejs.
In the end, every language can really get things done. And Typescript helps me pay
my bills and I couldn't be more grateful. Learn to love the quirks of your language and stop comparing it unfavorably with others. To date, I've never seen a language as elegant as ruby. Nor do I find an ecosystem better than python's at data science.
sushibowl · 3h ago
I'm sort of the inverse of this author: I have always liked Python and disliked Ruby. It's true though that python has changed a lot, and it's a mixed bag IMHO. I think every language feature python has added can have a reasonable argument made for its existence, however collectively it kind of makes the language burgeon under the weight of its own complexity. "one way to do it" really hasn't been a hard goal for the language for a while.
I'm really charmed by ML style languages nowadays. I think python has built a lot of kludges to compensate for the fact that functions, assignments, loops, and conditionals are not expressions. You get comprehensions, lambdas, conditional expressions, the walrus operator... most statements have an expression equivalent now.
it seems like, initially, Guido was of the opinion that in most cases you should just write the statement and not try "to cram everything in-line," so to speak. However it can't be denied that there are cases where the in-line version just looks nice. On the other hand now you have a statement and an expression that is slightly different syntactically but equivalent semantically, and you have to learn both. Rust avoids this nicely by just making everything an expression, but you do get some semicolon-related awkwardness as a result.
zelphirkalt · 2h ago
I feel similar about "weight" in Python. Some people can really overdo it with the type annotations, wanting to annotate every little variable inside any procedure, even if as a human it is quite easy to infer its type and for the type checker the type is already clear. It adds so much clutter and at the end of the day I think: "Why aren't you just writing Java instead?" and that's probably where that notion originates from.
I used to be like that. When I did Java. I used to think to myself: "Oh neat! Everything has its place. interfaces, abstract classes, classes, methods, anonymous classes, ... everything fits neatly together."
That was before I learned more Python and realized: "Hey wait a moment, things that require me to write elaborate classes in Java are just a little bit of syntax in Python. For example decorators!" And slowly switched to Python.
Now it seems many Java-ers have come to Python, but without changing their mindset. Collectively they make it harder to enjoy using Python, because at workspaces they will mandate the most extreme views towards type annotations, turning Python into a Java dialect in some regards. But without the speed of Java. I have had feedback for a take-home assignment from an application process, where someone in all seriousness complained about me not using type annotations for what amounted to a single page of code(, and for using explanatory comments, when I was not given any guarantees of being able to talk with someone about the code - lol, the audacity).
Part of the problem is how people learn programming. Many people learn it at university, by using Java, and now think everything must work like Java. I mean, Java is honest about types, but it can also be annoying. Has gotten better though. But that message has not arrived yet at what I call the "Java-er mindset" when it comes to writing type annotations. In general languages or their type checkers have become quite good at inferring types.
troad · 45m ago
I've come to the view that the best flow is to build a system in a dynamic language, and then - once you've got the broad strokes figured out - begin gradually typing it, where appropriate.
You definitely need to have a decent grasp of architecture to make this work - strict FP is very helpful to prevent any early spaghettification - but you ultimately get the best of both worlds this way: rapid iteration for the early stages and type safety once you develop a feel for the system you're building.
I've been doing this in Elixir in the last few months and I've really been enjoying it.
zelphirkalt · 16m ago
Yep, I agree with this. This is what I usually try in Python. Granted, Python is a way worse vehicle for FP than Elixir is, but I try to keep my procedures as pure functions as far as possible with not too big sacrifices in readability and performance. Most of the time a functional solution can be found, even in Python.
And maybe I am a little bit delusional thinking this, but in my experience, when you think deeply and come up with strict FP solutions, and you know what you are doing, then a lot of type issues don't arise, or are obvious to avoid. The simple fact that one thing you initialize once doesn't change over the course of its lifetime, already avoids tons of mistakes. You simply don't get this "Oh, is at that point in time that member of object x already modified, to be value y?" shit.
kirurik · 1h ago
I am not an experienced programmer, but I liked python because of the dynamic typing, but tbh no type hints are a nightmare (as I used to use python). These days I gravitate towards using type hints unless I am using an ipynb because it looks clean, but it can be a little much, it can look quite ugly. Not every usecase needs type hints is what I've learned.
zelphirkalt · 14m ago
A good compromise can be for example: Have your type annotations in the head of the procedure you are writing. That includes types of arguments and return type. You write it once at the head, and when you need to know you can look it up there, but you don't need to clutter the whole rest of the code. If you write well composing functions, then this will be all you ever need. If you write procedures 300 LoC, then well ... you shot yourself in the foot.
brainzap · 2h ago
I feel the samw, happy that Python is improving and getting more good tooling
IshKebab · 2h ago
Yeah Python with uv and Pyright is downright tolerable. As long as you don't care at all about performance anyway (and can guarantee that you never will in future).
futurecat · 1h ago
I find that Python is a very sad experience to read/write. I find the same for modern PHP. In contrast, Ruby's a joyful experience.
ZephyrBlu · 2h ago
I'm confused by this post because I think Sorbet satisfies basically all the things the author wants, and my experience with Sorbet has been really good!
No comments yet
postexitus · 1h ago
Ruby is a joy to program in. But Python is a workhorse.
Ruby is Miata MX-5. Python is Toyota Corolla.
What looks like stagnation to Steen is actually [1] Matz’s remarkable foresight that provided stability and developer happiness.
Steen’s not wrong that Python evolved and Ruby moved slower, but he’s wrong to call Ruby stagnant or irrelevant. Just think what we've enjoyed in recent times: YJIT and MJIT massively improved runtime performance, ractors, the various type system efforts (RBS/Sorbet etc) that give gradual typing without cluttering the language etc.
Ruby’s priorities (ergonomics, DSLs, stability) are different[2] from Python’s (standardisation, academia/data). It’s a matter of taste and domain, not superiority.
My reaction to that part of the post was, “Well, it seems like Python needed to evolve while Ruby was better-designed from the beginning. That’s a failing of Python, not of Ruby.” Language stability is a good thing, which is why I prefer Clojure myself. I know enough Python and Ruby to be dangerous. I’m certainly no expert in either one. That said, Python always struck me as a bit of a hack, but people seemed to resonate with the “indentation is significant” syntax, whereas Ruby felt like it was better designed, taking “everything is an object” to its natural conclusion, similar to Smalltalk, but suffering from performance issues because that means lots of more heavyweight message dispatch.
fuckaj · 3h ago
Likes Lisp Ruby and Typescript, interesting tastes (in a good way... nuanced)
nurettin · 1h ago
Ruby has a unified interface for select/map/reduce over all containers. They do lazy calculations if specified. You can chain expressions simply by appending them at the end without scrolling to the back of the expression. That is objectively better than lisp and python.
Sure, you can always rewrite to match that style with macros in lisp and generators in python, but they weren't meant to be used that way.
Sad thing about ruby is how they failed to do typing. I love python's typing module. I think it is the single best thing about python and I wouldn't touch python with a pole if it didn't have that module.
wild_egg · 47m ago
Lisp was absolutely meant to be used that way.
nurettin · 27m ago
What I meant was how (op modifier *params) "homomorphism" is praised by literally everyone and their dog and it is simply worse than params.op1(modifier).op2(modifier)
dudeinjapan · 3h ago
I still like Ruby. 15+ years in, I find myself in the camp of not wanting it to change. 25 year old me would have been totally jazzed about the addition of namespaces in Ruby 3.5/4.0. 40 year old me wants namespaces to get off my Ruby lawn.
codeduck · 1h ago
In your camp, waving a flag. I love ruby's simplicity when it comes to rapidly prototyping something, and find the wails about production type errors puzzling.
Only thing I've come near that gave me as much joy was Elixir, and I simply didn't have time to pick it up more than the most generic basics.
my mind just likes a.any? {|x| x.someCondition? }
zelphirkalt · 2h ago
Doesn't Ruby essentially already have namespaces, in terms of having modules? If one has proper modules, why would one ever need an alternative, weaker, concept for referring to things?
Manfred · 2h ago
To make sure code loaded from gems doesn’t shadow the namespace of the application.
dudeinjapan · 2h ago
Right. Today Ruby has essentially a global namespace, where every defined module/class/const is put in the same "global dumping ground" and can override/"monkey patch" each other.
Ruby 3.5 will introduce a new language keyword "namespace" that scopes behavior to that namespace.
class Foo
def foo; puts "foo"; end
end
namespace Bar
class Foo
def foo; puts "bar"; end
end
Foo.new.foo #=> "bar"
end
Foo.new.foo #=> "foo"
Fun times.
This is intended for isolated code loading similar to "modules" in Python or ES6, but I am worried it will be abused badly. I'm also unsure whether they will add a "use Namespace" construct...
I was a full-time Rubyist for a long time. I started the UK's first dedicated Ruby on Rails consultancy in 2006 before Rails was even v1.0 (IIRC the first apps I shipped back then were 0.8.6). I stuck around through the hype chain, and then started to help one employer break up a RoR monolith into micro services and adopt Java and Go (this was a mistake - we should have crafted the monolith better). I've built 4 startups as hands-on CTO with Ruby and Rails. It fed and housed me for many years.
In the last 5-7 years I've had to go in other directions. Clojure, Python, Java, even back to C and taking a look at Rust and Zig. I'm now in a role where I don't code so much, but I can see Ruby's problems - performance, the surprises, the fact it allows idiots to do idiotic things (nobody under the age of 40 should be legally allowed to monkey patch a base class or engage in meta programming).
And yet when I want to do something for me, for fun, perhaps advent of code, or a quick mock-up of something that's rolling around in my head, I reach for Ruby. Not elixir which has better runtimes, or C or Zig or Rust which has better performance, not something statically typed which leads to fewer bugs, not Python which has a huge data science community to it...
A few weeks ago I was listening to the DHH episode of the Lex Fridman podcast [0], where DHH talks about Ruby as a "luxury programming language". This matches my own experience.
When I need something to be fast, it's either because I'm dealing with a low-latency problem (and some of my side projects are very latency sensitive - 5ms can make the difference between success and failure), or because I can't afford the luxury of Ruby and Rails and the developer ergonomics.
Ruby makes things fun for the programmer. That's the point. It's beautiful to work with, even if it doesn't do all the things that all the coding books and blogs insist I should be ashamed to not have in my language.
I was slightly embarrassed to be a Ruby and RoR advocate for a while because of the brogrammer BS that emerged around both ecosystems in the 2010s. I then became very embarrassed because it wasn't as cool as a systems language like Rust or Go, or as intellectually deep as Haskell, or as hot on the ML bandwagon as Python.
But I think I don't care anymore. I'm just going to accept it for what it is, and lean into. Life's too short for "shoulds" - I'm just going to like what I like. And I like Ruby.
Ruby feels like a luxury manual hand saw. It fits in the hand perfectly. But it would not be my first choice for every project.
Languages like C#, Java, C++, Scala, Kotlin, and Python in 2025 feel like industrial computerized bandsaws with twenty different settings and controls. Some more complicated than others. They can be tuned to crank out a factories needs but you could spend days just fussing with a single setting that isn't right.
That being said, modern Python to me feels like the least thought out of these. It has been incrementally changed from one language to another, while being forced to keep many of the worst parts of both. To be honest, I think they should keep up the "breaking backwards compatibility" trend and make Python 4 an optionally-compiled, statically-typed language more like Go, but with more expressivity than Go.
I suppose F# is already like my ideal Python 4. It's possible to run as a script or compiled binary. It's a nice clean syntax, and the type system is a joy to use.
A valid F# program can be a single line script or dozens of configuration files. This let's the developer use it for quick and dirty work, then progressively tweak settings to run in a more industrial scale setting.
jemmyw · 2h ago
I've been on a similar journey. I was deep into rails early in my career. Then I moved on, especially liking typescript. I thought I wouldn't go back. But you don't always get the choice, a great job came up and it was a rails app. I found joy in it again - and I'm still there nearly 10 years on. Ruby feels like how OOP should be, it's so very easy to implement patterns that other languages make verbose and horrible. I'm guilty of a lot of metaprogramming, hope you forgive me, I am over 40. I think it can be an undervalued super power of the language: something isn't working or you need deeper insight, just break into the innards of any library you're using and insert logging and/or your own code.
Anyway, that said, for new personal projects I like typescript and rust. But recently I needed to stick an admin interface on such a project and rails shines there, you can get something good and secure stood up with less code and faff than anything else. In today's world of LLMs that is helpful too, rails is concise and old and has lots of open source projects to pull from, so AI breezes through it.
wewewedxfgdf · 3h ago
It's the never ending "end"s that bother me about Ruby.
class Mess
def chaos(x)
if x > 0
[1,2,3].each do |i|
case i
when 1
if i.odd?
puts "odd"
else
puts "even"
end
when 2
begin
puts "trying"
rescue
puts "failed"
end
else
puts "other"
end
end
else
puts "negative"
end
end
end
Clear away all those ends and the program logic pops out. Much fresher!
class Mess:
def chaos(self, x):
if x > 0:
for i in [1, 2, 3]:
match i:
case 1:
if i % 2 == 1:
print("odd")
else:
print("even")
case 2:
try:
print("trying")
except:
print("failed")
case _:
print("other")
else:
print("negative")
Alifatisk · 2h ago
The indent in your Ruby code is a bit weird. It should be like this
class Mess
def chaos(x)
if x > 0
[1, 2, 3].each do |i|
case i
when 1
if i.odd?
puts "odd"
else
puts "even"
end
when 2
begin
puts "trying"
rescue
puts "failed"
end
else
puts "other"
end
end
else
puts "negative"
end
end
end
I would have done it this way instead
class Mess
def chaos(x)
if x > 0
[1, 2, 3].each do |i|
case i
when 1
puts i.odd? ? "odd" : "even"
when 2
puts "trying"
else
puts "other"
end
end
else
puts "negative"
end
end
end
Or if you allow me to create a separate private method
class Mess
def chaos(x)
return puts "negative" unless x > 0
[1, 2, 3].each { |i| handle_item(i) }
end
private
def handle_item(i)
case i
when 1 then puts(i.odd? ? "odd" : "even")
when 2 then puts "trying"
else puts "other"
end
end
end
Lio · 48m ago
I'll leave aside the unnecessary test for parity as contrived for the example.
This is a question of style; it's possible to write ruby the way you have but with experience you definitely wouldn't.
e.g.
Why wrap the iterator in an if..else..end block? You could replace that with a one line guard statement at the top of the method. No end required.
Why use begin..rescue..end in the middle of your example? Just replace that with a single rescue at the end of the method. Again, no end statement required.
This is like nesting 20 if..else blocks in python and then complaining you don't have a monitor big enough to view it without scrolling. You just wouldn't do it that way.
My hope is that with the new ruby parser rubocop will be more agressive about automatically refactoring examples like this away.
latexr · 36m ago
That Python code looks like it was punched in the belly and is about to fall down on itself like a Jenga tower. Additionally, the last `else` is hard to track visually and if you make the slightest error in whitespace (which are invisible characters!), everything breaks.
To each their own. It’s because we all have different preferences that there are so many choices.
devoutsalsa · 1h ago
I'd love Python if it weren't for whitespace. I wanna cut/paste code into a REPL, and Python makes that difficult.
ghc · 1h ago
I find that the IPython REPL has downright amazing multiline support. I've always been envious of it when using GHCI. But even the standard Python REPL supports multiline paste just fine. So what exactly are you talking about? Rolling your own?
wewewedxfgdf · 1h ago
But the previous commenter just improved the Ruby code by adding whitespace!
PaulRobinson · 2h ago
I mean, that's a horrific piece of Ruby that doesn't do much, and you've not indented it properly.
Of course you can get all this down to a single line with ; demarcation.
And your `.each` could use `{ ... }` syntax, just like C or Java or... you know, everything else.
But sure, whitespace is better, or whatever it is you prefer.
Do you think Ruby could change something so fundamental as dynamic => static typing and still retain its beauty?
The only static typing solution I've seen for Ruby is Sorbet, and it's... not beautiful.
(Random example): https://docs.ruby-lang.org/en/3.4/String.html#method-i-lines
In a team, it is just so much easier to come across a "typed" function as opposed to an untyped one. You need to read the entire function to know what it is about.
VSCode was "good enough" for pretty much every language with LSP at that point, I did't even bother with Jetbrains ides outside of work after that.
And when Obsidian replaced org-mode for me, I deleted my .emacs directory from my dotfiles repository.
It was the opposite for me. Emacs + LSP + many other common conveniences all bind together so beautifully and efficiently that I can't imagine using any other IDE at this point.
I use kotlin nowadays…
If only the Ruby ecosystem had adopted Scala instead of Ruby, with cutesy books and eccentric underscored personalities, history might have been different.
I know that the Ruby community loves its clever runtime metaprogramming, but even the most metaprogrammed codebase is still going to consist mostly of plain old in-out methods. And as anyone who's ever typed a dynamic codebase knows, you pick up so much low-hanging fruit, in terms of edge cases and errors, when you slap some types on those. You don't need to type everything, but there is real hostility in Ruby circles to gradual typing, even where it would make sense and wouldn't impose any major costs.
Personally, I've stopped writing Ruby. Short of any pathway to sensible gradual typing, I just can't shake the feeling that every new line of Ruby is instant tech debt. Which is such a shame, since I find real beauty in the language.
Why do people make hating a tool their entire personality? I have noticed this same thing with languages like Go ("oh no Go still bad") and C++. I don't like C++ myself but I don't hate it. It would be like hating a screwdriver.
If you don't like a language simply don't use it, there are hundreds of alternatives. If your employer is making you write in that language you should hate your employer, not the language.
> The reasons behind this choice of employment are very much unrelated to the technology stack.
Programming language isn't the only factor for employment. People don't always get to just change jobs when an aspect isn't ideal for them.
On top of that, python is ubiquitous in some sectors. It's not as easy to avoid as a lot of other languages.
I hate Philips screwdrivers (but love JIS).
/s
Initially, the celebrated feature of python was that it allowed easy and fast development for newcomers. There was a joke a long the lines, "I learned python, it was a great weekend".
As much as I like python's type system (and wouldn't want to see them ever go way!), part of me wonders if moving into a world where hello-world can look like this, is a world where python is no longer the "lean in a weekend" language:
(obviously the example is silly, and I know this is a lot more than you need to do, hopefully you get my point though!)I'm very familiar with pyright and still I start most of my new projects without types and start sprinkling them in once I have a good base working already. This works so well that every time I pick up a static language I just get turned off by the friction of mandatory types and go back to Python. The only exception is Typescript where I can just Any everything temporarily as well.
Nobody's stopping you from manually parsing a couple of arguments. I still do it all the time and it's OK. If anything the magic of gradual typing is that you get to use it as necessity arises.
During my first Introduction to Programming course at university, I was taught Java. One thing that I found very troubling is that it wasn't easy, or possible in many cases, to change the programming language. Sure, you can write new functions or methods or classes, but I can't change the keyword for an if-statement. I also remember the TA saying "why would you want that?" I caught myself thinking "if we can program a computer, then why can't we program a language?"
15 years later, I still have this issue a bit, except I made my peace with it. It is what it is. There are some exceptions though! Such as: Lisp, Smalltalk and similar languages. It's in part why I have worked for a company that professionally programmed in Pharo (a Smalltalk descendant [2]). I remember hacking a very crude way for runtime type checking in Pharo [1], just for fun.
I'm not a Ruby programmer, all I know is that Ruby has some things that are identical to Smalltalk. But my question to the author would be: if you long for things like keyword arguments, type hints and namespaces why don't you program it in the Ruby language yourself?
Or is that really hard, like most other languages?
[1] https://youtu.be/FeFrt-kdvms?si=vlFPIkGuVceztVuW&t=2678
[2] Fun fact, I learned about Lisp, Smalltalk and Pharo through HN! So I know most of you know but I suspect some don't.
I think that's why extremely flexible languages have seen limited adoption - if your language is more of a language construction kit where everyone can implement their own functionality, everyone has to implement their own tool support (or, more likely, live without any) and there's a limit to how far you can go with that. The best languages find the sweet spot where they give you enough flexibility to implement most reasonable programs, but are still constrained enough that tools can understand and work with all possible code.
Flashbacks to scala operator PTSD.
No. I don't want to use ++<>^^%% operator! I am not a number! I'm a man!
Is a typical response of someone without the background and without the imagination. It may well be, that doing Java-only for too long robs one of both. An alternative response could have been: "What a fascinating idea! How would you apply that? / What would you do with that?"
I am happy for you, that you found the exceptions and that your picture of the computer programming world is not as incomplete and bleak as that of the TA back then.
And they aren't the exact same question.
https://www.baeldung.com/java-reflection
https://www.baeldung.com/java-annotation-processing-builder
Then you've got the byte code itself, and there be dragons: <https://aphyr.com/posts/341-hexing-the-technical-interview>
While you rarely see byte code shenanigans in Java code bases, it's how some other languages on the JVM achieve things like runtime metaprogramming.
The ergonomics of ruby still have me very much liking the language as it fits how I think, but there are a lot of good developments in the usual neighbors, and I see myself picking up both Python and JS ever more for small projects.
Error handling for instance has always been my pet peeve. With dynamic languages like python, errors were all "exceptions". But then golang came along and decided they'd be values and that only the truly exceptional errors should be "panicked". But the if err != nil syntax became super verbose only after I learned about the Result<Ok, Err> from Rust and the matching syntax associated with it.
A lot of people are shocked when they learn about ruby's monkey patching. I for one never truly groked the packaging of python applications until uv came along to deliver an experience similar to npm.
And I agree, Typescript is the state of the art as far as static typing on top of a dynamic language is concerned. But I never considered it a programming language. More like a tool to assist developers write/manage large javascript code.
In the end, I think the true reason for returning to pythong probably had more to do with getting a python gig. I live in the part of the world where my tech stack ended up being influenced early on by the places I worked. I didn't mind learning Typescript for my first gig or improving my skills with nodejs.
In the end, every language can really get things done. And Typescript helps me pay my bills and I couldn't be more grateful. Learn to love the quirks of your language and stop comparing it unfavorably with others. To date, I've never seen a language as elegant as ruby. Nor do I find an ecosystem better than python's at data science.
I'm really charmed by ML style languages nowadays. I think python has built a lot of kludges to compensate for the fact that functions, assignments, loops, and conditionals are not expressions. You get comprehensions, lambdas, conditional expressions, the walrus operator... most statements have an expression equivalent now.
it seems like, initially, Guido was of the opinion that in most cases you should just write the statement and not try "to cram everything in-line," so to speak. However it can't be denied that there are cases where the in-line version just looks nice. On the other hand now you have a statement and an expression that is slightly different syntactically but equivalent semantically, and you have to learn both. Rust avoids this nicely by just making everything an expression, but you do get some semicolon-related awkwardness as a result.
I used to be like that. When I did Java. I used to think to myself: "Oh neat! Everything has its place. interfaces, abstract classes, classes, methods, anonymous classes, ... everything fits neatly together."
That was before I learned more Python and realized: "Hey wait a moment, things that require me to write elaborate classes in Java are just a little bit of syntax in Python. For example decorators!" And slowly switched to Python.
Now it seems many Java-ers have come to Python, but without changing their mindset. Collectively they make it harder to enjoy using Python, because at workspaces they will mandate the most extreme views towards type annotations, turning Python into a Java dialect in some regards. But without the speed of Java. I have had feedback for a take-home assignment from an application process, where someone in all seriousness complained about me not using type annotations for what amounted to a single page of code(, and for using explanatory comments, when I was not given any guarantees of being able to talk with someone about the code - lol, the audacity).
Part of the problem is how people learn programming. Many people learn it at university, by using Java, and now think everything must work like Java. I mean, Java is honest about types, but it can also be annoying. Has gotten better though. But that message has not arrived yet at what I call the "Java-er mindset" when it comes to writing type annotations. In general languages or their type checkers have become quite good at inferring types.
You definitely need to have a decent grasp of architecture to make this work - strict FP is very helpful to prevent any early spaghettification - but you ultimately get the best of both worlds this way: rapid iteration for the early stages and type safety once you develop a feel for the system you're building.
I've been doing this in Elixir in the last few months and I've really been enjoying it.
And maybe I am a little bit delusional thinking this, but in my experience, when you think deeply and come up with strict FP solutions, and you know what you are doing, then a lot of type issues don't arise, or are obvious to avoid. The simple fact that one thing you initialize once doesn't change over the course of its lifetime, already avoids tons of mistakes. You simply don't get this "Oh, is at that point in time that member of object x already modified, to be value y?" shit.
No comments yet
Steen’s not wrong that Python evolved and Ruby moved slower, but he’s wrong to call Ruby stagnant or irrelevant. Just think what we've enjoyed in recent times: YJIT and MJIT massively improved runtime performance, ractors, the various type system efforts (RBS/Sorbet etc) that give gradual typing without cluttering the language etc.
Ruby’s priorities (ergonomics, DSLs, stability) are different[2] from Python’s (standardisation, academia/data). It’s a matter of taste and domain, not superiority.
[1] I'm stealing a point DHH made on Lex's podcast. https://www.youtube.com/watch?v=vagyIcmIGOQ
[2] I'm once again parroting DHH/Matz
Sure, you can always rewrite to match that style with macros in lisp and generators in python, but they weren't meant to be used that way.
Sad thing about ruby is how they failed to do typing. I love python's typing module. I think it is the single best thing about python and I wouldn't touch python with a pole if it didn't have that module.
Only thing I've come near that gave me as much joy was Elixir, and I simply didn't have time to pick it up more than the most generic basics.
my mind just likes a.any? {|x| x.someCondition? }
Ruby 3.5 will introduce a new language keyword "namespace" that scopes behavior to that namespace.
Fun times.This is intended for isolated code loading similar to "modules" in Python or ES6, but I am worried it will be abused badly. I'm also unsure whether they will add a "use Namespace" construct...
See here: https://bugs.ruby-lang.org/issues/21311
In the last 5-7 years I've had to go in other directions. Clojure, Python, Java, even back to C and taking a look at Rust and Zig. I'm now in a role where I don't code so much, but I can see Ruby's problems - performance, the surprises, the fact it allows idiots to do idiotic things (nobody under the age of 40 should be legally allowed to monkey patch a base class or engage in meta programming).
And yet when I want to do something for me, for fun, perhaps advent of code, or a quick mock-up of something that's rolling around in my head, I reach for Ruby. Not elixir which has better runtimes, or C or Zig or Rust which has better performance, not something statically typed which leads to fewer bugs, not Python which has a huge data science community to it...
A few weeks ago I was listening to the DHH episode of the Lex Fridman podcast [0], where DHH talks about Ruby as a "luxury programming language". This matches my own experience.
When I need something to be fast, it's either because I'm dealing with a low-latency problem (and some of my side projects are very latency sensitive - 5ms can make the difference between success and failure), or because I can't afford the luxury of Ruby and Rails and the developer ergonomics.
Ruby makes things fun for the programmer. That's the point. It's beautiful to work with, even if it doesn't do all the things that all the coding books and blogs insist I should be ashamed to not have in my language.
I was slightly embarrassed to be a Ruby and RoR advocate for a while because of the brogrammer BS that emerged around both ecosystems in the 2010s. I then became very embarrassed because it wasn't as cool as a systems language like Rust or Go, or as intellectually deep as Haskell, or as hot on the ML bandwagon as Python.
But I think I don't care anymore. I'm just going to accept it for what it is, and lean into. Life's too short for "shoulds" - I'm just going to like what I like. And I like Ruby.
[0] https://www.youtube.com/watch?v=vagyIcmIGOQ
Languages like C#, Java, C++, Scala, Kotlin, and Python in 2025 feel like industrial computerized bandsaws with twenty different settings and controls. Some more complicated than others. They can be tuned to crank out a factories needs but you could spend days just fussing with a single setting that isn't right.
That being said, modern Python to me feels like the least thought out of these. It has been incrementally changed from one language to another, while being forced to keep many of the worst parts of both. To be honest, I think they should keep up the "breaking backwards compatibility" trend and make Python 4 an optionally-compiled, statically-typed language more like Go, but with more expressivity than Go.
I suppose F# is already like my ideal Python 4. It's possible to run as a script or compiled binary. It's a nice clean syntax, and the type system is a joy to use.
A valid F# program can be a single line script or dozens of configuration files. This let's the developer use it for quick and dirty work, then progressively tweak settings to run in a more industrial scale setting.
Anyway, that said, for new personal projects I like typescript and rust. But recently I needed to stick an admin interface on such a project and rails shines there, you can get something good and secure stood up with less code and faff than anything else. In today's world of LLMs that is helpful too, rails is concise and old and has lots of open source projects to pull from, so AI breezes through it.
This is a question of style; it's possible to write ruby the way you have but with experience you definitely wouldn't.
e.g.
Why wrap the iterator in an if..else..end block? You could replace that with a one line guard statement at the top of the method. No end required.
Why use begin..rescue..end in the middle of your example? Just replace that with a single rescue at the end of the method. Again, no end statement required.
This is like nesting 20 if..else blocks in python and then complaining you don't have a monitor big enough to view it without scrolling. You just wouldn't do it that way.
My hope is that with the new ruby parser rubocop will be more agressive about automatically refactoring examples like this away.
To each their own. It’s because we all have different preferences that there are so many choices.
Of course you can get all this down to a single line with ; demarcation.
And your `.each` could use `{ ... }` syntax, just like C or Java or... you know, everything else.
But sure, whitespace is better, or whatever it is you prefer.