15 ms·
What is best way to master Ruby for generalist engineer? I know C++ and Python, JS, Typescript well enough. Python was easiest, since it took couple of days to
by hemantv 5y ago
What is best way to master Ruby for generalist engineer? I know C++ and Python, JS, Typescript well enough.
Python was easiest, since it took couple of days to master fundamentals and I was writing good code in no time.
Also anyone working on Typescript equivalent for ruby?
- mega-tux 5y agono exactly the same as js->ts but Crystal language in a typed, compiled lang. with Ruby like syntax but other nice features like Go like concurrency & speed, macros, great C interop. and they are working on an interpreter, too.
- ljm 5y agoSorbet[0] is probably the closest to what you're looking for. It's not something I would recommend to someone who wants to get started with Ruby, since it would be limiting to learn it as if it was a statically typed language. [0] https://sorbet.org/ https://sorbet.org/
- lloeki 5y agoSorbet is OK if you want to type an app, but falls apart for a lib. RBS (descs) + Steep (type checker) is a bit younger but I found it more usable in general, especially on the corner cases.
- ljm 5y agoYeah I've tried setting it up for a library but Sorbet won't pick it up, Tapioca won't pick it up. It'll generate its own types which are exactly what I don't want. Beyond that, it's too intrusive in the code for me. I could live with 'sig' blocks above methods, but there's an immediate readability cost when you start having to wrap stuff in T.let, T.must, T.nilable, etc. Personally I'd rather improve my testing skills here too. Knowing how to write a good test is a valuable skill.
- oezi 5y agoIf you are already up to speed with many programming languages then getting into Ruby shouldn't be that hard. Some syntax is a bit quirky (blocks in particular) but if you are solid in OOP then you soon see the beauty of the core class setup. The primary difference to Python is that everything really is a method call on a object (even if that object is a class). To master Ruby I would start with toy problems such as Advent of Code.
- danielheath 5y agoThe main thing that’s different in ruby is the support for and widespread use of metaprogramming. I’d suggest using metaprogramming (define_method, instance_variable_send, instance_eval, send) to implement a toy ruby-in-ruby DSL is the fastest way to figure out what different.