5 ms·
How I wish Ruby had been adopted as the glue-lingua franca instead of Python. I get zero joy from writing Python.
by Toutouxc 2y ago
How I wish Ruby had been adopted as the glue-lingua franca instead of Python. I get zero joy from writing Python.
- te_chris 2y agoAgree 100%. I’ve made peace with python, accepted that I need to use it, but I hate it. Death to for loops.
- kstrauser 2y agoReally? That's one of the things I like about Python: how its for loops consistently consume an iterator, and that's it. Anything that looks like an iterator can be looped across or used in a comprehension without special casing.
- ahartmetz 2y agoI remember some Ruby tutorial that proudly showcased a 5.times begin loop_body end loop. Too cutesy IMO.
- pjmlp 2y agoPython was on the right spot as Tcl/Perl successor, Ruby only became known thanks to Rails and arrived too late for that. Already in early 2000's CERN was scripting their builds, Fortran and C++ tooling with Python. Their Grid Computing tutorials, predating what we now call Cloud, already used Python.
- masklinn 2y agoYeah like many things Python's overnight success was the result of a decade of work. Python started involving scientists (and creating science-oriented SIGs) in the mid 90s. Numpy's original ancestor was Numeric, first released in 1995.
- agos 2y agoI've probably not tried hard enough, but I always got zero joy from writing Ruby. Way too much magic.
- graypegg 2y agoTotally valid point, but I do think magic is more a property of the clever (usually reflection-based magic) things people make with Ruby, less so the language. The draw towards magic is actually because of the logically-consistent object model Ruby is built around that I find to be less magical and edge-case-filled than other script-y languages. If you just use it as a glue language to call out to other things, prepare data, and iterate over results: it's pretty clear and concise. (I do personally like the reflection-magic in a lot of Ruby apps, so I might be overlooking something that feels normal to me, but is some very weird behaviour to anyone else!)
- rat87 2y agoHow is pythons object model less "logically consistent"? Multiple inheritance is dangerous but I'm not sure if its logically inconsistent. And it doesnt have the issue that ruby has of procs not being objects
- graypegg 2y agoRuby borrows a lot from Smalltalk. Everything is an object, including things that are normally keywords elsewhere like Class or Module. There are no public properties on objects, only methods, which is technically only « messages » and object can receive. Ruby does well with metaprogramming magic because most of the languages own keywords and concepts can be rewritten at runtime. They’re implemented AS Ruby code. I would say it’s logically consistent because there isn’t as many « special » things. Python’s def keyword is special. You can’t make your own, nor can you hook into it. In Ruby, that’s just a message being passed to the current scope’s object. You can do anything you want to it. Ruby plays by a pretty consistent rule book.
- rat87 2y ago
- williamcotton 2y agoIt's so great for writing DSLs. This magic might turn some people off but the result of this meta-programming makes for some very expressive and concise code.
- lelanthran 2y ago> It's so great for writing DSLs. This magic might turn some people off but the result of this meta-programming makes for some very expressive and concise code. The problem with DSLs is that you now have a different language for each project you have to maintain. Each time you come across some little DSL that shortens the original writers work by a few lines (at most), you have to read it carefully, and in depth, to understand what was intended. I'm turned off by Ruby for this reason alone. If I want the ability to throw little DSLs all over my code, Lisp does it better and more readably.
- torben-friis 2y agoI keep hearing about the dev satisfaction with ruby, but I'm starting to work with it and I haven't yet felt it at all - I see many footgun design decisions like clashing classes not being an error, and blocks feel like a more cumbersome/limited version of lambdas/first class functions. I'm not saying this to attack the language, just pointing my current mental picture to ask: what's the magic everybody loves? I know there is something there because it's an almost unanimous view among ruby devs, so I want to get it.
- GenericCanadian 2y agoAs someone who's worked with Ruby for 12 years here are some insights: Ruby makes message passing first class. That just changes how you think about programs. In exchange you give up passing functions so our anonymous functions are our blocks (actually just another object that can receive messages). So you don't `list(something)` you `something.list` and that lets you change what `.list` does depending on who `something` is very easily. Ruby's defining feature is that the line between language author and program author is razer thin. You can completely change the language yourself by extending core classes. This is why we have `1.day` in Rails even though its not supported in the main language. DHH (author of Rails) could add that without consulting Matz (author of Ruby). So lots of stuff gets prioritized to make developers happy because its easy to add. In Ruby the messages you receive are passed up the chain of ancestors. Your ancestors are a linked list of classes going back to a root class like `Object`. You can modify this linked list at will with mixins and inheritance with complete control (should I go before or after this other receiver). Ruby's REPL and debugging experience is amazing. I often keep one tab with an `irb` or `rails console` open to sketch things while developing the code for it elsewhere. I'm also always inside a debugger to figure things out. When I'm in Rust or Python I'm met with a very different environment.
- torben-friis 2y agoI get the debugging experience, as I've already found it pleasant and painless compared to the difficulty of setting debugging environments in other languages. But for the messages first approach and thinness, what's the real world benefit in practice?
- tombert 2y agoA small part of me is still holding out hope that Julia will catch on. A guy can dream...