>Ruby and JavaScript have modern dependency managers (bundler and npm/yarn). They're easy to get working cross-platform.
Ruby is easy to get working cross-platform? The only fully supported platforms are Linux and OS X (and really only the Linux-like parts of OS X). Ruby on Windows is a trainwreck, and other platforms are not supported at all. Meanwhile C++ runs on everything and the toaster. Ruby might have many strengths but cross-platform support is not among them.
> It doesn't have first-level functions, instead it has blocks
Ruby also has lambdas, which if not first-level functions, are pretty darn close.
> It doesn't have namespaced imports, instead its imports effectively behave like includes (i.e. the "dump truck" approach to imports).
I can't tell if you're talking about `require` or `include`.
`require` is strictly meant for loading source files. If you want things to be restricted to a particular namespace, you should use `include` to pull in a particular module (once the module's code has been `require`d or otherwise `eval`d or defined).
> Ruby isn't widely used in practice
What? Ruby on Rails is ridiculously popular as a web framework.
> Installing it requires some amount of care and technical knowledge
On Macs and many GNU/Linux distros, Ruby is already preinstalled.
> don't even bother installing it with a Linux package manager -- you're almost guaranteed to end up with the "wrong version" of ruby and rubygems
Um, what? The only thing I can think of is a really old packaged Ruby. Otherwise, it's actually pretty hard to go wrong, in my experience having installed Ruby on pretty much every GNU/Linux distro known to man.
> but it would be nice if there were well-written books aimed at a more general audience.
O'Reilly and Pragmatic Programmers both publish a wide variety of excellent Ruby programming books that are very much "aimed at a more general audience".
> I'm not sure what the "best" first programming language is. JS has its merits
Oh good god no.
> and all you need to try it out is a modern web browser.
If that's what matters to you, then you can do the same with Ruby. Take a look at tryruby.org, for example.
>> the fact that as a language Ruby is superior to Javascript remains, even if Javascript VMs are a hundred times as fast.
As someone who frequently switches between Ruby/Rails and NodeJS (sometimes in the same day), I wonder about this statement (err, fact).
You mentioned that the Ruby language is superior and that this is a "fact". What about the Ruby (I know Node isn't really a language, but for the sake of discussion, Node,JS,npm) is substantially better that the speed trade-off is worth it (besides familiarity)?
In my case, I'm familiar with both, and I prefer Node,JS,npm. Node,JS,npm are definitely not perfect, yet still, I like it over Rails,Ruby,Gems/Bundler.
I'm not looking to "win" here; I'm just very curious now given your assertion.
> Ruby is commonly used by programmers along with Ruby on Rails for Web Development so it's scope is very limited.
Not correct. Its primary use case doesn't limit its scope, and there's tons of utility programming done in Ruby. (for example, Chef and Puppet are written in Ruby)
> So many JS projects are switching to TS, but AFAIK the same isn't happening within Ruby
The sheer propagation of JS might have something to do with the big push to have some kind of typing. From my own experience, if I see ruby I know I can either re-write it or find an alternative in TS/JS.
The ubiquity of JS makes it more accessible, but I'm still trying to find reasons why one would choose Ruby.. I'm always a 'right tool for the job' but I don't know what the niche is.
Edit : My pedant in me :
> compile step the way typescript doe
Typescript transpiles to JS. I don't 'believe' there is a compilation step.
>> ...it's hard for me to even consider the idea of Javascript being in the same category as Ruby.
Indeed. I think anyone would agree...they were not built for the same purpose; however, let's set some expectations here. As it relates to backend JSON APIs, what is better about Ruby/Bundler?
>> Ruby was designed from scratch to be a perfect...dream
OK, that's fine. Though, I've never heard of a proven perfect language/platform, regardless of intention.
>> I really want to write half a book more about why I think Ruby is so much better than Javascript...
Please, no book, but I would be happy to read one concrete example of why Ruby/Bundler is substantially better hands down. Of course, you are free to argue that you just don't like JS. I'd be fine with reading that, but I'm still curious to see a real example. I'm willing to accept that I may be wrong, but without proof, we can't get there.
Yes, Ruby is a nice looking language; still, I have not come across any proof that writing, maintaining, and deploying Ruby/Bundler is substantially better than writing, maintaining, and deploying Node/npm for backend JSON APIs especially given the gratis performance benefit and ease-of-use of Node/npm.
The same or better result with lower overhead and better performance. Before I ever wrote a line of JS intended to be executed via Node.JS, I actually thought Ruby was better as well :)
*
NOTE: I am quite aware that some Haskell lover is probably laughing and sticking their nose up at this entire conversation. That is perfectly fine because I'm willing to bet they can actually provide the concrete example I am looking for.
> What I find amusing lately is the exodus from Ruby over to Javascript. What's the thought there - maybe there weren't enough braces? Maybe THIS time, this scripting language will work! What valiant hope.
I'm not one of these developers, but I believe the appeal is largely the ability to work with one language in the "full stack": Node.js on the server, JS in the browser obviously, and maybe MongoDB or Postgres.
>Why not use Ruby, or Python, or JavaScript -- or even Go, Rust, Clojure, or Scala? (Yes, I realize that the latter two run on the JVM, which would have been problematic in other ways.) Heck, they could have bought RubyMotion and made Ruby the high-level language of choice for development.
Because OBVIOUSLY none of them solve the problems they wanted to solve (interoperabillity with Objective-C, fast, native, IDE integration, etc. Including RubyMotion which is a half-arsed implementation.
That seems a bit apples-to-oranges to me. The degree of hype is similar, yes, but other than that they seem like different animals. Ruby started slow (performance-wise), with memory leaks (that were denied at first), and was predominantly a community development. Node.js is running on top of V8, which is mature, performant, and backed by Google.
Not at all, they used to be competitors in the web space but Python won the academia space. Python is taught at university in Europe, Ruby far less.
Node.js is a mess, not because of javascript but all these layers of complexity imposed by professional front-end development, and on the server because Node.js standard library is pretty poor. I shouldn't have to use a third party library just to parse a multipart http request or work with cookies...
Go in that domain is just examplary. The std lib even comes with a Go parser, which is just invaluable for implementing code analysis tools, and it's very easy to do so.
> Ruby is an interpreted language released in 1996 for scripting. Why are we surprised when attempts to shoe-horn it into something else (Ruby 3.0, JRuby, Truffle Ruby) fall flat?
Because Lua (1993) and JavaScript (1995) can be very fast.
> Ruby on Rails just has a much better bang for buck than C++ and customers know it. Powerful hardware is dirt-cheap these days, so nobody wants to pay for the extra +50% you get from C++ over JavaScript.
Depends. Use cases with highly constrained hardware SWaP where inches, ounces, and watts matter, the expense to optimize may well be worth it.
> excuse my ignorance, but are there any major developer tools that don't support Windows?
The entire Ruby ecosystem has never had great Windows DX: the most recommended Windows builds of Ruby itself come from a "second-party" group because official upstream doesn't seem to care to bundle nice installers, there's a ton of papercuts on Windows in the base libraries even in APIs you don't think would be platform-dependent, and a large number of third-party libraries and apps just kind of invariantly assume that you will never try to use them on Windows.
Ruby is easy to get working cross-platform? The only fully supported platforms are Linux and OS X (and really only the Linux-like parts of OS X). Ruby on Windows is a trainwreck, and other platforms are not supported at all. Meanwhile C++ runs on everything and the toaster. Ruby might have many strengths but cross-platform support is not among them.
reply