this post was submitted on 30 Sep 2023
109 points (91.0% liked)
Programming
17449 readers
149 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
For the beauty of the language: Ruby
For Doing Businessy Things For Business: Kotlin
For low-level, gotta-go-fast: Rust
I love Ruby since I got introduced to it. The syntax is great and you can do many things in a simple manner.
Before that, Python was my go-to language for scripting but now I cannot stand the syntax anymore. I dislike the lack of braces and forced indent.
That's funny, I dislike Ruby for probably the same reasons you like it. I don't want a language that's clever or elegant, I want it to do exactly what I say and nothing else. Lower level just makes more sense to me, I'd be a shit & unproductive software engineer.
Well Ruby does exactly that though. The methods have good documentation so it's easy to find what something does. There is no magic in the language that makes it do something else than what you wrote.
I get that. Ruby does do a lot under the hood for me. But I like that! Different Strokes and all that.
I guess, for general programming tasks, I enjoy when the language is "clever" enough to do The Right Thing for all the bits I don't really care about in the moment (like memory management) so I can focus on the logic that solves my problem.
Otoh, my last "big" personal project was a terminal multiplexer (and some supporting TUI widgets) that needed to run on a raspi zero W. I started in Python, then moved to Kotlin and finally Rust in the pursuit of performance. Once one of the parts I needed to care about became efficient performance, moving to a lower-level compiled language was the move.
Indeed, one app in particular took 1.5 min to run in Python...which ultimately dropped to 3 sec in Rust - and that was mostly network latency!
I love languages of all sorts. I'm currently writing an interpreter for a language I'm designing for fun. I'm starting off in Ruby while I figure this all out. I fully expect performance to be appalling. But Ruby lets me build faster while I'm testing things out and learning how interpreters work.
Once I've got my interpreter working though, I'm planning to port it to Rust for better performance.
My terminal is written in Ruby, and it uses a font-renderer that's 100% Ruby ( https://github.com/vidarh/skrift - I didn't write it from scratch, it's a port from C ), and it's definitely possible to get things "fast enough" for a surprising portion of code in Ruby these days, but you may end up writing Ruby code that is "surprising". For faster Ruby, see e.g. Aaron Patterson's walkthrough of speeding up a lexer which ends up doing things most Ruby devs would not usually do because at least some of the things he ends up doing goes against the readability (e.g. the TrueType renderer I linked above definitely sacrifices speed and assumes you'll memoize heavily to maintain readability). For an interpreter, you're probably right to drop to something lower level.
That was a super cool article!
...As it happens, I'm writing a parser in Ruby right now, so this is incredibly timely. Thanks!
Not trying to convince you - people have different preferences, but Ruby does exactly what you say and nothing else unless you start pulling in gems that do lots of monkey patching or metaprogramming cleverness.
This is one of the reasons I dislike Rails in particular - it twists people's idea of what clean Ruby can be like and introduces a lot of "magic" conventions that makes the code hard to read for someone who doesn't know Rails.
A lot of Ruby programmers do overdose on the "clever", often inspired by Rails. You can do some truly insane things with metaprogramming in Ruby, but a lot of the time the cleverness is unnecessary and a bit of a footgun that people grab too early instead of thinking the problem through and realising there are simpler solutions.