391 points · by thunderbong · 3y ago · 330 comments
https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-rele...
It's disappointing that there are so many more jobs for another popular language - one that lacks the elegance and consistency but which has a larger ecosystem.
As far as I know, the only well known reason for a company to choose Ruby is if they want Rails (and obviously if the founding team already knows/likes Ruby). But that other language also has a popular (and comparatively clumsy) web framework plus well known modules for all the fantasy capabilities that startups dream of... you know, the AI/ML "not sure how we will use it but we know it will be great, and it's good for marketing".
Sadly, I don't expect this situation to reverse in the future. Maybe like blockchain, once the AI/ML fantasy hype dies down the other comparatively-unpleasant language will lose general appeal and Ruby will gain more attention.
Edit - also, the domain squatters "rubylang.org" should lose their domain. There is no legitimate excuse for having this domain which redirects to a general garbage site.
> Ruby ... its combined attributes of brevity, expressive power, and feature consistency.
> [Python] lacks the elegance and consistency
First I would argue Python is very consistent in its design, it aims to only have one obvious way to do things and so it's easy to guess how apis will work. It also aims for explicitness, which makes code very easy to follow and reason about.
Secondly on "brevity" and "expressiveness", I don't really see them as an attribute that make a language "better". Sure for experienced developers who like a personal game of code golf (don't we all at times!) those are attributes can can make coding more "fun". But that doesn't necessarily translate to code that is ideal when working as part of a team, or code that is easy to follow when a new developer starts on an existing codebase.
Ultimately I think that's why Python has gained more traction than Ruby, it's an "easer" language to follow and start with. Ruby is probably a more fun and intellectually stimulating language to work with though.
In essence, I don't think it has anything to do with elegance, syntax, or "easiness". It's more about timing + origin + corporate adoption:
* Python was created in Europe, Ruby was created in Japan - when Ruby gained more recognition in English-speaking world (~2004), Python has already been present and used worldwide for a decade
* Ruby was created as a personal, hobby project; Python was created while Guido worked in research institutions, and it helped Python gain recognition in academia environment
* Guido joined Google in 2005, boosting the adoption of Python; Ruby has never gained such a large corporate backing
Eventually I believe it was the combination of the latter 2 that pushed Python to top spot in popularity - scientists all over the world were familiar with Python, and with the rise of Data Science/ML (with Google being one of the main forces behind it), it became the most obvious choice for the new tools.
As a data point, I remember interviewing for an internship in a research institution doing some work on medical images around 2002/2003 and the supervisor telling me that Python was the lingua franca in this domain (from a research and POC development perspective).
GvR’s background probably helped spread the word and thus get feedback, but as often Python’s overnight success was the result of years of work.
Google used Python very early, but other languages became more prominent in 2005, culminating in the creation of Go, after which GvR left.
Indeed people talked a lot about Google "supporting" Python, but the support was pretty minimal (50% job for GvR, where you cannot really do much).
Python has way better marketing though the PSF though. They understood that you can create a circus around the language that is completely removed from engineering, fundamentals and actual core development. If Ruby had been as shameless, it might be #1 today.
Perl was everywhere (on Linux/Unix). Then Python came along an offered enough net benefit over Perl that it really started to displace it, and became the defacto scripting language that you would reach for when creating programs on Linux/Unix.
Ruby has some niceties over python, but doesn't provide enough of a net benefit over it for that same kind of displacement to happen.
Or at least they are similar enough that one pulled ahead and subsumed the other. Like a twin eating his brother in the womb. Maybe it could have gone the other way and we would have ended up pretty much in the same place. Or maybe it is a case of worse is better. But not that much worse/better frankly and here we are. Salivating over rust. ;)
I never understood how this can be considered consistent at all, and those IMHO language design warts made me look into Ruby at the time.
Has this improved since? I know print was changed in Python3 to make it not-special.
The justification for len() is thinner: Guido van Rossum thinks it looks better, and it enforces a consistent name with a consistent meaning (you don't get length methods with different names, or with the right name but strange behavior). Under the hood it just calls obj.__len__(), so it's only the notation that's not OOP.
There are no multi-line lambdas because nobody could come up with an indentation-based syntax for them that Guido van Rossum was happy with.
In short: none of them improved, all of them have reasons, some of those reasons are bad.
Sure, multi line lambdas might be nice, but equally you can define functions wherever you need them so it’s not really all that different.
res = [x**2 for x in range(10) if x != 5] sorted(arr)
arr.sort()
versus arr.sort
arr.sort!One thing I think Ruby gets right is the naming convention for methods that modify the object they're called on (<obj>.<method>!) and callables in general that return a boolean (<callable>?).
My biggest gripe with Ruby is the class implementation. I find metaclasses a bit more difficult to understand in Ruby. I hate that I can't easy determine where a given method of an arbitrary object is defined.
I recall that it wasn't uncommon for popular libraries to "open up" a class that was an integral part of Rails and redefine methods, overriding the original implementation. I recall trying to figure out why the method I was calling wasn't returning the value I expected, even after reading the Rails source. Come to find out, some random library had overridden it. They'd matched the behavior of a previous Rails version, but the Rails behavior had since changed. I spent hours on that specific problem and still resent it to this day :P.
Someone new to Ruby will be WTF is the ! for?
It's slower than Ruby, has worse package management and less consistent syntax but if you want to use Tensorflow, PyTorch, etc..., it's the default.
Django was released in 2005 and RoR in 2004. I suspect my journey was similar around then (late 2005), I had used PHP, classic ASP and a little Perl. I was looking for something better, read the tutorials for both Django and RoR. Had a look at what desktop GUI toolkits were available for both Ruby and Python (I wanted to lean one new language), Python had a few more options and so went with Python and Django.
At the same time Python was gaining significant traction in the scientific community with NumPy (2006/1995) and SciPy (2001). Ruby I don't believe had an answer to that back then. I was vaguely aware of that and it somewhat influenced my decision.
Ultimately it was the two pronged (web + scientific) development of the ecosystem that pushed Python ahead of Ruby.
When Ruby and Rails started to make an appearance in European circles, around 2007, it hardly mattered when Python was already around.
Any reference/numbers to back this up ? Just genuinely curious about this.
That’s like saying that Dodge Neon is Slower than Mazda Miata.
Both are bottom of the barrel compared to any compiled language.
I’ve seen that statement multiple times, but in my experience it’s far from the truth. For every thing I ever had to look up in Python I often found more than one way of accomplishing the same task and all of them were (subjectively) uglier and less straightforward than Ruby.
> on "brevity" and "expressiveness", I don't really see them as an attribute that make a language "better". Sure for experienced developers
It’s an attribute including for inexperienced developers. Perhaps especially for them. Even for something as basic¹ as writing a file, one needs multiple lines of code and know about `with` or opening and closing the file². In Ruby: `File.write("/path/to/write.txt", "file contents")`. One line, immediately understandable.
> that doesn't necessarily translate to code that is ideal when working as part of a team, or code that is easy to follow when a new developer starts on an existing codebase.
Agreed. Though in Ruby I have found myself thinking “I wonder if this keyword will work” and it does exactly what I expected. With Python, the norm is frustration with the impossibility of doing the simplest of things like defining a constant.
¹ From the coder’s point of view, never mind the underlying implementation.
² Failing the goal of one and only one obvious way to do something.
I don't know enough Python to say anything about how easy it is but Python existed for a decade or so before it became popular and that was after Ruby had became popular. That points to it not being popular because it is easy but for some other reason. My guess is BI and AI made Python popular.
Python was just clear to read.
Ruby looked a bit cleverer but was not so simple. Coming from working on a large C++ code base, I decided Python was the one to do next. Simplicity, clarity and one obvious way to do things as a philosophy.
This argument is dead the second one stumbles upon the string interpolation/formatting situation. Or the list comprehensions, ew.
who='World'
#1 - string concatenation
'Hello, ' + who + '!'
#2 - % operator
'Hello, %s!' % who
#3 - format() method
'Hello, {}!'.format(who)
#4 - f-strings
f'Hello, {who}!'Working with various Ruby-adjacent stuff for 10+ years and nothing about Ruby was even "fun" to work with, it was mix of "WTF" and "who designs language like that!".
Python is also not "easier" to start with, I'd put Ruby/JS/Python to be at pretty similar level there. No worrying much about types (till they bite you, inevitably, of course, and cause untold bugs), simple things are simple and actual proper (i.e. "not send it to some piece of C code to calculate) multithreading sucks donkey balls.
I work in Python now, and I often have to use 5-7 lines for what would have been 2-4 in Ruby. Because you have to clutter the Python with trivial details, not because the Ruby code is "magic".
[1] https://wbk.one/article/a463c360/the-ruby-tutorial-i-wish-i-...
Ruby more like a philosophy major designing an OOP language - getting done and enjoying getting there were the goals. I took to Ruby more because i never cared about the "engineering" part of languages - just using them as tools to get things done.
May be now, but for a long time when RoR first came out, many people pick python instead of Ruby because scalability. Maybe a lot has improved with Ruby, and with introduction of Crystal, that may not be an issue any more.
... and decent first party docs, actual code modules rather than “execute every source file in the global namespace”, a first party Windows build, etc., etc., etc.
If the Ruby community can't acknowledge the real things holding it back compared to other available options, well, that makes it that much harder to catch up.
I don't think the execution model you mention, which results in the absurdity of C style transitive includes polluting the global namespace, will ever be changed though.
Searching for a mismatched/missing _end_ is preferable to having a line or block get accidentally unindented and end up still "working" (running) while producing very confusing results.
Moving blocks of code in Python requires great care, especially since the editor cannot reasonably guess which scope level the paste should go into.
Also, the lack of an _end_ or bracket as with other languages means the editor cannot visually assist with identifying block boundaries. To be fair though, my vim-memory of using % to bounce between start/end brackets doesn't work in Ruby because of the begin/end words instead of matched symbols :(. However, RubyMine does show the beginning of the block as an unobtrusive popup at the top of the window when your cursor is on the _end_ keyword. That's super handy when there are several blocks closing in succession.
There is a proposal at https://bugs.ruby-lang.org/issues/19024 to change this but, as you can see from the comments, it’s a bit tricky to get right while preserving backwards compatibility. (Whether that conversation makes you more or less optimistic about the chances of it ever being changed is up to you.)
This suprises me. I've missed `end`s before as much as anyone, but I guess as an OCD reformatter (prettier, IntelliJ, rubocop, etc.), they show up VERY OBVIOUSLY and right quick. They've never even been an itch, much less "pain".
Django and RoR are much of a muchness. Ruby and Python are too, to a lesser extent. This whole thing stinks of narcissism of small differences and sour grapes. To imply that even most users of the most popular non-browser language in the world are partaking in ML hype is utterly absurd.
When you need to use nebulous words like “clumsy” to describe why you don’t something it’s inarguable that you’re unable to not take your own familiarly into account. I prefer Python, am certainly more familiar with it, and could truthfully say that I feel about Ruby the way that you obviously feel about Python. The difference is I’d never jump onto a Python post on Hacker News and try to pass these feelings off as fact in a way that puts down so many people for preferring a certain tool.
It really isn't. On the whole I've rarely found a tech community that is kinder and more welcoming than Ruby's.
I have used both languages extensively, off and on for nearly 20 years. I've also used C, C++, Java, and built some small projects with Clojure and Elixir.
Of course people have differing sensibilities when it comes to aesthetics, but at a certain point equally observed options can be compared - with one being recognized as better.
I don't put down Python or Pythonistas because I dislike them; I just voiced my frustration that so many companies choose Python when I obviously believe there are better choices (particularly similar complexity/feature options like Ruby).
Clumsy, an incomplete comparison:
Python
OOP
Having to explicitly pass self.
Not having public/protected/private members. Ruby does, including convenience attribute reader/writer functions. And in Ruby you can still provide your own custom methods. In Python, you have to keep an internal _attrname and then have some set_attrname function if you want to provide special logic on your setter.
General recommendation to not use dunders, except that you should define dunders such as __init__ and __str__ for many classes. Ruby's class initializer is an optional method called... "initialize". (Principle of least surprise.) It also has a standard of to_something() methods which return the object in different formats, such as to_str, to_i, to_f, etc. More on this later.
Built-in functions:
sorted(), a past tense verb, doesn't "sorted" a list, it gives you a sorted copy of a list. Not to be confused with list.sort(), which also sorts but returns nothing and mutates list.
next(), which mutates the iterator you pass it. Most other built-ins do not mutate their arguments.
int(), float(), sorted(), next(), etc. all only work for certain argument types. The way to know is just to know. In Ruby, these would be object methods. And you could know if you could do foo.to_i (convert to int) just by asking "abc".respond_to?(:to_i).
Incidentally, Python's int("abcd") raises an exception, while int("1") works as expected. You can't ask the string "can you be converted to int?" Now maybe converting strings to ints is unwise in general, and that's fair. But the ergonomics here are... not good.
And regarding sorted() vs foo.sort(), in Ruby we have foo.sort (non-destructive, returning a sorted list), and foo.sort! (mutates in place). The ! indicates a more significant impact of the function compared to the non-bang version.
Elsewhere in the threads I illustrate list comprehension vs Ruby's collection methods and blocks.
Ternary operator:
Many languages: flag_set ? 1 : 0
Python: 1 if flag_set else 0
This is an if else. So written as an if else, it would be:
if flag_set
1
else 0
The Python ternary operator rearranges this logic.But! In Python you can't do "1 if flag_set". Ironically, that's fine in Ruby.
Speaking of block return values... (from the imperative if/else above)...
Ruby:
x = if flag_set
1
else 0
endYou cannot do this in Python because conditional blocks do not return a value.
It is common in Ruby to say x = case(foo) ... and each match will have a value. The value of the expression in the case which matches is used to set x. In Python (now that you finally, as of 3.10 actually have a switch statement), you must repeat the x = expr for each match.
I will say I'm amazed that after so long of no switch statement in Python, they chose to build one with pattern matching reminiscent of Elixir's.
If I were to dig through my memory I could find more examples of Python oddities. My decision to merely compress it all into one word - clumsy - was to avoid getting into these details, particularly since the assumed audience was Ruby users based on the topic.
After using languages with no statements, going back feels like a pointless restriction in expressiveness. You don't even need a ternary operator when blocks are expressions that can be used for assigning to variables.
And look, I LOVE Ruby. I come from twentyish years of Perl, and I really like the way Ruby feels when banging out a script but these days, time is in short supply, and I just don't have time to screw around with Ruby.
If I were someone who was gravely concerned with Ruby's future, I really don't know where to even begin.
* DataSci/ML scene is basically nonexistent, that's a problem.
* Windows scene isn't good, at all. That's a problem. At least it's kinda there, so you wouldn't be starting from scratch at least, like Crystal team has fought with.
* I think something could be done with integrating Rubocop or some other linter (? idk what real Rubyists use) in order to begin solidifying the code culture. PEP8 is a huge factor of Python's success imo.
* Packaging. I'm not familiar with the modern Ruby stack, but in my limited dabbling, rake has done just fine. In Python, hearing about Packaging Issues is the new vogue from customers/people who have no idea what they're doing in the slightest. I've used pip/setup.py in the past, but funny enough I'm actually reading up on Hatch lately, which is the new hotness.
Anyhow, I don't think it's quite fair to throw this much shade at Python when Ruby hasn't really addressed any of the things that makes Python so popular. If Ruby is so much better, than it needs to do all those things at least as well if not better.
Surveys, such as StackOverflow’s (https://survey.stackoverflow.co/2022/#section-most-popular-t...) consistently find that
> Windows is the most popular operating system for developers, across both personal and professional use.
If it makes anyone feel better, I’m in this filter bubble as well. I’ve never seen someone program professionally in Windows.
Then I moved to Mac, and it was almost as great. (The terminal situation and general integration of the command line is still more cohesive in Linux.)
For about the past 10 years, I've been at a standard Fortune 250 Windows-is-the-entire-world kind of place. I've been able to do my work on my personal Mac, but I've always made sure that I can do all of my Rails work on my corporate Windows laptop. There are times my code needs to access file locations and other applications inside the corporate firewall.
Obviously, people are correct that Ruby is not a "first-class" citizen on Windows, but RubyInstaller (https://rubyinstaller.org) has been a lifesaver. Not only does it "just work," and compile all the gems I've used, but it also includes a neat little script that addresses the common "corporate" practice of having to install custom SSL certificates so that IT can decode all traffic going through their firewall. (They install these certs directly into the Windows networking stack, but bundler doesn't use the stack.) The SSL bundle their script creates is also useful for use with Postgres database connections. You just need RubyInstaller, NodeJS, and a better terminal application (or maybe RubyMine), and you're GTG on Windows.
I've tried to use WSL, both version 1 and 2. If you need to support many Rails apps, and switch Ruby versions (with RVM or rbenv), that might be the way to go, but for just one (big) project, I prefer to stay inside the native environment. And even if I were tempted to use WSL, I'd rather just use an actual VM software like VMWare or OpenBox, and control the details of the virtualization myself. YMMV.
And I can acomplish any other task a regular developer can do (and I was doing) programming in Java (with sdkman), using docker containers, git on the command line, Big Data tools (flink, iceberg, haddop, etc) and even some bash scripts (nothing too fancy).
The only things that bothers me are the CRLF x LF and sometimes the windows defender making the fans go crazy, but thats is a minimum and I can do some workarounds, the same way I did with bluetooth and audio on Linux.
I guess company laptops that run Linux have been vetted a little more.
My issue is that most companies using Python probably don't need the Python-only libraries. Aside from the fantasy AI point I originally mentioned, I think Python is the PHB's choice (like the mauve database) because that's what they've read in or heard in their circles, or because the first person building the webapp wants Django's built-in admin interface (which always becomes a problem later, like apps in Excel become problems later).
> Rubocop
Yes, it is fairly standard. And I dislike it like I dislike Black (Python's PEP8 dominatrix). Although Rubocop goes well beyond by giving you often helpful advice about optimization choices or unnecessary code. I like it for that, but I want to format in a more column-oriented way than Rubocop or Black allow (without config mods).
Black is a horror show to me. It's almost like it was designed to chew up as much vertical whitespace as possible. It's not as bad as PHP norms, but it really does like to turn pleasant tight blocks into twice as many lines and extra ( ) (out of necessity, since Python can't deal with linebreaks well).
Two minutes of silence for the poor sods who still thinks that AI/ML is pure hype.
(Granted, there is hype. But there is much real stuff.)
And, also, blockchain and ML/AI are nothing similar, except for Twitter bottom-feeders trying to milk each.
AI/ML already has real applications with hundreds of millions of dollars actual value created. And just like CS itself, AI/ML will perpetrate more and more fields in the coming days.
There may not be an AGI soon, or ever, but mark my words, AI/ML will continue to have growing real applications in different fields.
Blockchain had only hype. ML has substance + hype (AGI, silver bullet to all problems, etc.).
I will not engage in language wars like GP here, because those are stupid.
I work all day with Python, and I also enjoy coding in Ruby sometimes in hobby projects.
Hundreds of billions a year probably (and that may be low) if you count online advertising and large consumer facing sites in general. If you turned off the ML behind Facebook/Google/Netflix/Amazon then you'd be lucky to only lose 50% revenue based on my personal experience of adding ML on top of such products.
I said, "there are so many more jobs for another popular language", and I was clearly speaking of the broad job market... not a few big players.
ML in recsys of Netflix and product suggestion/placement in Amazon are worth tens of billions of dollar alone, per month.
It's the most productive ecosystem out there because of the sheer level of polish that exists within the Gem ecosystem and the Aspect Oriented Programming capabilities that make it so easy to plug and layer functionality from them.
Combine that with this relentless commitment to Developer Experience and it's a tremendous enabler. No other language and ecosystem that I know of enables so few people to accomplish so much, so fast, so well.
Sure. Once all of online advertising, search (web, ecommerce, specialized sites, etc.), image editing, spell checking, recommendations (streaming, ecommerce, email, marketing, etc.) and a hundred other things cease to exist. Or more broadly once every large consumer facing company decides, for whatever reason, that it'd prefer to make significantly less money.
People talking about things without realizing what they are and where they're used usually indicates that their broader argument is going to be filled with equally many invalid assumptions and logical holes.
I did not say that AI/ML is not useful. But I'm quite sure that some (many) of the companies using Python are not doing any of that - even if they say on their pitch deck that they are or will.
The Python standard library has never straight up failed on me in the way that Ruby has.
Ruby had buggy named-argument splatting, i.e. func(*kwargs), until 2.7, and even that was a half-realized implementation. It took something like 5 years to fix: https://bugs.ruby-lang.org/issues/11860
I've had similar experiences with Rails.
Django is today more elegant, more complete, and better documented than Rails ever was. 10 years ago you would have been correct. 5 years ago they were about evenly matched. Today it's not even close. Python is eating the world, and web frameworks are no exception.
- Async support was second class back then, not obvious how to implement fully.
- REST APIs are a library add-on instead of first-class. An excellent library, but still.
- The package ecosystem sometimes reminded me of the wild-west that is Node.js
- Dependency management is a complicated story (arguably caused by Python, rather than Django itself)
- Django Models are cool and expressive, but nowadays I would rather express my models in something like a dataclass, or a Pydantic model, or just a regular class...
Maybe Rails has these problems and more, I don't know. I'm not saying I'm never going to use Django again, but there's a large chance I will look elsewhere for a batteries-included framework next time I need one.
> one that lacks the elegance and consistency
upvoted for perfectly concise description of that language.
it is even more sad knowing that high quality alternatives for the most popular libraries exist, but inertia is simply too high.
@work I've tried to introduce Ruby to my colleagues that are very bad at programming, but good at science. They ditched it with reasons like "I don't like it" or "it's too slow" without even measuring (it is not! Shopify would have died by now). I'm still using it without them knowing and it's the reason why I'm 10x faster than everybody else to build solutions.
The other language it's the only one they "learned" at uni and keep using it for everything, even when it's the worst possible choice, management doesn't care and doesn't know the difference.
software engineering is still not engineering, unfortunately.
Don't ask me...
> Ruby in science is the path of most resistance; if your work isn't already hard enough
It actually isn't that hard, honestly.
Very few people do cutting edge work that requires analyzing massive amounts of data and, from my experience, other languages are not much better.
They still rely on C (or Rust) bindings, because they aren't adequate per se for the task.
> That's because everyone is using Python
Yep, the aforementioned inertia.
But, IMO, as a programming languages nerd, some syntax are worse than others and I have to review many Python programs that conceptually read like someone speaking a foreign language without knowing the rules, like "I go make shoppings". That code wasn't "created" but simply copy/pasted from somewhere else and then adapted because some concepts don't require understanding, just tinkering.
Python it's not easier than Ruby, shooting yourself in the foot with Python it's easier than in Ruby and yet, here we are.
At least in the diatribe C vs Rust, C is actually simpler than Rust as a language and programmers have to learn fewer concepts, even though Rust is better as a language/ecosystem overall.
> Everyone uses English, so you have to too
That's exactly the point, the most spoken language in the World is English spoken by non native speakers. Like me. It's not British English or American English (in Europe is Russian, anyway, and Chinese and Spanish would like to have a word with you).
So it is people's Esperanto, which is kinda of an abomination linguistically, but language evolve naturally it does not need a compiler or an interpreter to work.
When I am abroad for holidays or conferences, I can perfectly understand what people mean when they speak "Engrish", native speakers often don't.
A recent submission about it
https://news.ycombinator.com/item?id=25784683
But in programming the concepts are the same in every language, so it's not like learning Finnish if you are Egyptian, it's more like learning to ride a motorbike if you can ride a bicycle.
People learn Pandas and Numpy and Scikit-learn, not Python, when I learned how they worked porting the examples to Axon[1] wasn't hard. I managed to do it with the help of a colleague whose versed in learning programming and he thought Axon was more readable than Python. But then again, people usually think they know X better, feel more confident in X and will keep making the same mistakes over and over, because they don't know what they don't know and their salary do not depend on it. They have people like us fixing their code. Their salary depend on writing "I know X" on their CV, which usually is just not entirely true.
Ruby just got out of fashion, but it isn't inferior to any other language out there and its ecosystem is completely fine.
Reminder: TruffleRuby exists.
[1] https://github.com/elixir-nx/axon
edit: formatting
in no particular order, on top of my mind (there are many more):
- mixed environments when you can't compartmentalize Python in a container. Python package management is one of the best examples of "poor implementation"
- mixed environments, when both Python 2.x and 3.x are present. Migration to Python 3.x is the textbook example of "badly executed". And we are still not entirely there 10 years after.
- prototyping web apps, in the same time spent configuring Python venv, you have a perfectly functioning Ruby prototype
- writing web apps, in the same time you understand how to make a custom sql query in Django, you're already selling your first product in Ruby and the website won't be ugly as hell by default. Rails is the killer app, nobody can deny it.
My biggest gripe with Python is that many times when I have to deploy Python, I discover an issue and ask the author(s), I'm back to "but It works on my computer" times, like when I started, in the 90s of previous century.
Yes, Python is used to write beautiful things such as youtube-dl and Sublime Text (porting Sublime to Python 3 is one of the reasons why Sublime is almost dead). However, given the fact that in Sublime plugins are written in Python, people flocked to (even!) Atom, because they could use other languages, not inherently better, but with less issues connected to the language used.
I lost count of how many times Sublime died on me and stopped working spouting Python errors that I had no time nor will to fix.
Disclaimer: I am a paying customer of Sublime 2 and 3.
Edit: lots of Pythonists triggered for no reason apparently. Don't take it personally, if you have counter opinions, express them. Downvoting is not an opinion, it's a passive aggressive way to show disagreement, which frankly is the reason why we're still stuck with Python. I don't mind an honest discussion and people disagreeing with me, it's why I am here after all.
It is what it is.
The problem for Dlang is that it never reached the popularity Ruby did.
Airbnb, Github, Shopify, Gitlab, old Twitter (and many, many others) are all written entirely in Ruby on Rails.
Ruby is not "pretty fast". The hardware you run it on is insanely, mind bogglingly, out of this world fast and so people don't notice the way that they used to.
...which is fine, you don't always need to be fast. Just be wary of misattribution.
Ruby today is slow as hell, but not as much as slower than other slow as hell languages as Ruby used to be.
And that there, is the whole "Problem" of Ruby.
Ruby is a beauty. Rails isn't. It's nice, productive (for certain niches) and has a long track-record. But Rails is also often the root of problems such as maintainability, long-term-productiveness, hosting (performance, scaling), and lock-in.
There are far better solutions for simple CRUD-apps today than writing them all out in MVC code. And when you need complex business-logic (i.e no longer a simlpe CRUD app) the , the weird MVC (plus Concerns) that rails offers is simply not cutting it.
Yet Ruby is Rails, and Rails is Ruby. So when Rails looses its niche and usefulness, Ruby uses it's niche and usefulness. And that's a shame.
(I am a 12+years Ruby, former Rails, and now moving-to-Rust developer)
But I do see the fading popularity of Rails (and therefore) Ruby to start affecting its usefulness. Less libraries, fewer bindings, abandoned libs and fewer hosting options.
This smugness is insufferable to me. What are you talking about?
(Also if you ask me Ruby never was cleaner and more elegant than Python in the first place, at least in the ways that matter; there are definitely things it does better, but if one of your language's selling points is scripting style use then there are limits to the value of consistency)
I work with PHP and Laravel too and after working with Rails 7 for a bit Laravel is like a cheap imitation.
I also work with python a lot and I wouldn't want to do the web work in python as much as I would ruby but I would rather do the data crunching in python.
It appears the Elixir community has observed this pattern and has learned from it; time will tell whether that lovely language can build enough popularity to overcome its relative niche status.
(Context: Ruby is my primary programming language; I rotate clients fairly frequently; nobody doesn’t use Rails.)
Elixir has first class access to an incredibly rich (and battled-hardened) network/distributed ecosystem... if you need it. I know there are major voip companies who build on it, and of course Discord is famous for what they were able to do efficiently with it. These are all outside the realm of Phoenix.
That's not to say Phoenix isn't significant. I think it will definitely be a bridge that pulls Ruby (and the few willing Python) devs over to Elixir. It got me, and I built a successful project in it a few years ago.
However Ruby's syntax is way nicer. I can actually write what I think instead of having to translate my thoughts into python. Of course over time working with python has made my thoughts to conform into more pythonic way, but I still occasionally find myself thinking how something would have been way nicer to write in ruby instead.
def foo(*)
bar(*)
end
is some needless nonsensical bloat, who on earth complained "oh, saying def foo(a) is so 90s, we need to have option to replace it with symbol used for multiplication or pointers in some cases!"It's mediocre language that happened to have some then-popular web framework written in
def foo(*rest)
bar(*rest)
end
if that helps? What would you prefer instead of the asterisk?But Ruby is slow. Performance matters. In a world when everything seems to run in cloud servers, efficiency matters.
If you can have 20 times more simultaneous users in the same cloud server by using a different tech stack, there's no reason to keep using Ruby.
For the record, I also think Python is generally slow, but it has improved in the latest version, and the important libraries for Python are written in C++.
Except for the ML/AI use case, Laravel has more batteries included I would argue than Django. A ton more features when compared to Rails. All of them are first party solutions for things like Auth/Queues/Monitoring/Payments/Testing/Local Development and even some starter kits.
If you're building a new web based company that isn't focused on building the next AI avatar generator, Laravel should be on your radar if you're also considering Rails or Django.
And C++20 is actually very nice to use.
In contrast, these two, Ruby and Python, are slogs.
There'll obviously always be the exceptions like Twitter having to migrate off Ruby (Well rails) because scaling is just too hard. But those are exceptions.
But it wasn't positive experience with Djangonauts. It was negative experience with RoR devs. I've never had random Django person come from nowhere either on web dev forum or PHP forum to *flame* others for using PHP. But it was regular thing with Rails devs. AFAIR the term "Rails Zealot", meaning combative tribalistic RoR developer who goes around the web to try to convince other devs that they should switch to RoR using aggressive and flaming rhetoric comes from around that time.
I've though this was regular PHP hate, but when I've started learning Django and participating on Python communities I've found out that at smaller scale the flamewars are also there. But this time the reasons why I am "harming myself" and "not real programing" were different.
> The WebAssembly System Interface is not a monolithic standard system interface, but is instead a modular collection of standardized APIs. None of the APIs are required to be implemented to have a compliant runtime. Instead, host environments can choose which APIs make sense for their use cases.
Uhh… OK, I guess. So it’s a collection of APIs to allow Web Assembly programs to make system calls? Why not just say that?
Edit: The official release notes do not make this mistake. https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-rele...
- JIT - "just-in-time" compilation
- YJIT - "Yet Another Ruby JIT"
- Regex - "regular expression" / sometimes "rational expression"
https://bugs.ruby-lang.org/issues/19104
they are using memoization to defeat regular expression denial of service (ReDoS)
It is mentioned only briefly in Cox's article on regex matching in the wild. Look for the word "bitstate": https://swtch.com/~rsc/regexp/regexp3.html
I didn't know Perl had implemented this trick too.
The paper[1] cited in the Ruby bug ticket was published very recently. When I first read the Ruby bug ticket, I immediately wondered how they sidestepped the memory use problem. The paper's abstract seems to suggest there is some technique for doing so, as it rebuffs the idea of doing "full" memoization. Alas, I do not have access the paper. (Which is fucking ridiculous.)
def is_float?(fl)
fl =~ /(^(\d+)(\.)?(\d+)?)|(^(\d+)?(\.)(\d+))/
end- 1.4
- -1.4
- .4
- -.4
- 1.
- -1.
... plus exponents, also you don't need a decimal point if there's an exponent
Won't Ruby parse a string into a float? I would just use that and check for an error unless your requirements are different.
Doesn't Ruby allow scientific notation for floats?
/(^(\d+)(\.)?(\d+)?)|(^(\.)(\d+))/edit: thank you to everyone involved
Ruby 3.2.0, on a M1 MacBook Pro hitting a simple healthcheck route in a production Rails 6.1 app with wrk (`wrk -c8 -t8 -d30s http://localhost:3000/healthcheck`):
- 423 reqs/second with JIT disabled (using 229MB of RAM)
- 74 reqs/second running with `RUBYOPT="--yjit"` (using 385 MB of RAM)
I must be doing something wrong?
RubyVM::YJIT.enabled?
RubyVM::YJIT.runtime_stats
[1]: https://sorbet.org
When we tested, there was barely an experimental type checker for RBS, that was 1 year ago.
Overall, we tried, had to bail out and stick to YARD. Horrible experience.
It's dedicated for esp32 programming but it has semantics very similar to Ruby and Python while syntactically it is incredibly simple and clean.
you deserve more publicity, really lovely :)
Haven't touched either since like Ruby 1.8/Rails 3
In case you want to stay up to date with what is happening in Ruby world I am curating a free weekly newsletter at https://newsletter.shortruby.com (I took a two weeks vacation but will be back soon with new editions).
- Static typing
We have RBS but that is written to a separate file, the only thing I see being close is the Contracts gem
- Lots of first class scientific libraries and other cool libs
http://sciruby.com is working towards lowering that barrier
>This novel approach lazily generates type-specialized versions of basic blocks on-the-fly while propagating context-dependent type information.
Does anyone know how it is different from tracing JIT compilers?
I can highly recommend watching their presentation on it: https://www.youtube.com/watch?v=PFb5wNj2ztM
The actual memory increase depends heavily on the app size so I could quote some figures but it would likely be irrelevant to you.
Some people might be struggling with memory usage and may not see it as worth it, but for others who may have some extra RAM sitting around, it might come as a free perf increase.
As for memory usage, proper use of CoW can reduce it dramatically: https://github.com/Shopify/pitchfork/blob/master/benchmark/R...
Which means the `end` keyword can be elimilated all together :D
where i live, Germany, is java .net and 99% are enterprises old managers with old software :(