8 ms·
So thankfully, it would appear that Ruby is kept alive by the Japanese. I have never really understood the craze for Python . I am by no means a guru, but I co
by Lordarminius 9y ago
So thankfully, it would appear that Ruby is kept alive by the Japanese.
I have never really understood the craze for Python . I am by no means a guru, but I consider Ruby a far superior language; ( yes, I recognize that the numerous scientific and ML libraries of python make it a logical choice for many projects, but this is sort of like a self fulfilling prophesy)
My love for Ruby declared, I have on occasion wished that we had a "strict" feature in the language similar to ES5 that would permit only the use of Ruby's more straightforward features and also exclude deprecated methods and techniques. This might give the language a deserved boost.
Does anyone know what the most utilized language in Japan is ?
And what framework they use there for web projects, if not Rails ?
- yzmtf2008 9y ago> I consider Ruby a far superior language Have you looked at the C source of Ruby? :) In terms of that, Python is far, far superior to ruby. EDIT: to clarify, CPython is much cleaner than MRI, and has a much-better-documented API for extensions. This is what I believe part of the reason that Python has a much better coverage for scientific packages.
- rurban 9y agoDisagree. I deal with the C parts of Perl, Ruby and Python and better VM's on a daily basis. Ruby has by far the cleanest implementation of the VM. Almost like the VM of a good Lisp/functional lang. Python and Perl are the worst of all, on par with PHP. Ruby is unfortunately also the slowest. But not because of the VM implementation, only because of the everything is a method architecture, even for the simplest primitives. The ruby API is pure and clean, this is what makes it slow. For the python or perl API too much inner state needs to be handled, which makes it slow also. Because you cannot use a better design for data and code. Only php made significant advantages there recently, so you don't have to worry about inefficient data and code, only about the eye blead VM.
- yzmtf2008 9y agoI don't know if I can agree that the Ruby C API implementation is the cleanest -- from my experience I'll say it's very pure, but pure does not really mean clean, and it sometimes (esp. when performance is a concern) makes writing C extensions messy. Python's C API could be argued that it uses too much abstraction, but it definitely makes it that much easier to write extensions.
- jeltz 9y agoHm, I usually see Ruby ahead of Python in benchmarks and head to head with Perl.
- ksec 9y agoI remember Charles Nutter ( Head Dev of Jruby ) Tweeted a while ago saying how clean the CRuby Code base was.
- jeltz 9y agoHaving worked with both I found the MRI codebase very clean and nicer to work with than CPython.
- flavio81 9y agoPython is slightly less powerful but is pretty fine for many tasks, and much easier to learn than Ruby, with a consistent syntax. So you can quickly learn it and then spend the rest of the day focusing on getting things done.
- Lordarminius 9y agoIt should be possible to delineate a "core" syntax for Ruby as well and leave the language esoterica to more adventurous practitioners. Why is this not a thing ? See my previous comment
- owebmaster 9y agoThis is a thing. Most "railers" use a very strict subset of ruby features, although Rails itself uses a lot.
- Lordarminius 9y agoI would disagree. For instance, there are at least two syntaxes in use to describe hashes; parentheses are optionally (and inconsistently) used and so on. Rails suffers from the same issues as does the language
- deleted 9y ago[deleted]
- zeckalpha 9y agoThis is a thing. Ruby has an ISO standard: https://www.iso.org/standard/59579.html https://www.iso.org/standard/59579.html
- sametmax 9y agoHow is Python less powerful ? They both have metaclasses, monkey patching, first class functions, unicode... Ruby has blocks, Python has decorators. You can solve pretty much the same problems with the same number of lines.
- int_19h 9y agoPython is arguably more "obviously readable", in a sense that when you see some construct, and you don't know what it is, but you have a guess, that guess is usually correct. It makes the grammar more verbose than Ruby in many ways, and idiomatic Python is almost always more verbose than idiomatic Ruby, but for many people, ease of reading and understanding is preferable.
- ouid 9y agoI dunno man, I don't think the languages are properly comparable for readability. 5.times do print "s" end
- vectorpush 9y agoIt's a double-edged sword. The code's behavior is apparent in that simple example, but things get considerably more difficult to understand when you're dealing with monkey patched methods and dangerously clever method_missing magic in non standard library code.
- singingfish 9y agoYeah, I had to deal with a perl port from a ruby library that had kept most the rubyisms in. The really disturbing thing about it was the Frankenstein levels of autovivification involved. Fortunately someone (not me) is going to get paid deal with that soon.
- int_19h 9y agoYou can certainly find snippets that are simpler in Ruby than in Python; they're just not the majority. Consider a slightly more complicated case where you need to print out items in a range with some modification. Idiomatic Ruby: (0 ... 5).each do |x| print (x + 1) end Idiomatic Python: for x in range(0, 5): print (x + 1) To understand Ruby, you need to know what || does, and the overall sequencing of the words as you read that construct is somewhat unnatural for English. Python is comparatively easier to parse with no prior background. It is definitely possible to write Ruby in a way that's still highly readable. But from what I've seen of real world Ruby code, that's not the way it tends to be written - idiomatic Ruby values expressiveness and DRY, so you see blocks and various terse syntactic sugar used all over the place; lots of "clever" code in general. There's nothing wrong with that - I generally prefer expressiveness over readability myself - but many people do not.
- cutler 9y agoAccording to Indeed.com (title search) there are 4 PHP jobs to every Ruby job in Japan and 15 Java jobs to every 2 Ruby jobs.
- hetman 9y agoI used to have a preference for Ruby but Python has a single killer feature missing for me from Ruby and that is explicitly imported module symbols. When looking at new unfamiliar code in Ruby there's just no way of instantly knowing which symbols come from which files/gems. There are conventions, sometimes these are followed well, sometimes not. Either way it adds a lot to the mental load of parsing new code or even old code you've written your self. Ruby's module import system is just too much like C's #include.
- antod 9y ago> I used to have a preference for Ruby but Python has a single killer feature missing for me from Ruby and that is explicitly imported module symbols. As someone who has to now deal with a couple of complicated/convoluted Ruby codebases, that is one of the biggest things I miss from Python too.
- sanderjd 9y agoYeah, I've come to think this is perhaps Ruby's biggest design miss. It can be really hard to trace dependencies in Ruby, and doing so is a prerequisite for any deep understanding of what's going on. (Granted, this is mostly a problem in Rails projects, but the fact is that Ruby makes this problem possible.)
- Daishiman 9y agoThis is the number 1 failure in Ruby for me. It makes large codebases unmaintainable in the long term.
- jeltz 9y agoYes, Ruby is my favorite language but they really messed up the module system. Ruby basically has no module system at all and everything is in the global namespace.
- hetman 9y agoI mean, that's not technically true, there's definitely a module system. In fact, in some ways Ruby's module system is more powerful than Python's since it's completely divorced from the concept of the file. You can split a single module across multiple files or create multiple modules in a single file. You can nest modules as well of course. The problem is with the module import system, which as you alluded, imports the module structure in a given file into the global namespace. And it imports everything! There's simply no way to say which bits you want and where they should go. I actually don't really see a reason why the import system could not be changed while keeping the module system in general as is. I wonder if anyone has ever tried something like that...
- nine_k 9y agoRuby embraces and favors magic. Python shuns magic and goes for one correct and explicit way. The languages are pretty similar. The community attitudes are different.
- sayelt 9y ago> Ruby embraces and favors magic. Python shuns magic and goes for one correct and explicit way. Could you please give examples of this? I never understood where this idea comes from.
- setpatchaddress 9y agoThe languages are not very similar. What gives you that idea?
- zubat 9y agoDynamic types, OO with some extension for functional style, inherited Algol syntax with some homegrown innovations, batteries-included design. Where they differ, it's largely in whether they bend towards consistent style(Python) or more late-binding power(Ruby).
- rurban 9y agoCannot agree. Ruby loves its MOP, python loves its method overloads. Both are highly magic, but a MOP is technically superior to overloads, because you just flip the vtables and don't have to look at every single method call, if some python programmer decided to overload it. Perl has no builtin MOP, and even worse overloads than python.
- kudokatz 9y agobut the ruby community takes modules to magic extremes. Just take the overload of include vs. extend as one example. Some modules don't even have any reasonable error messages or try to detect when someone stomps on their names or data. It's a madhouse with ruby modules that try to be "magic" or "easy", which is never "simple". If you ever find yourself pulling back the curtain of many ruby modules, it's time to dig in and swear as you go.