3 ms·
8 Months of Ruby
- djaouen 3y agoAfter my first few years in Python (before types), followed by my last few years in Lisp/Elixir, I am skeptical of types. Can someone point me to specific examples where types are not just more code to maintain/make things uglier?
- Alifatisk 3y agoI can't directly point you to any specific example but when I tried Typescript for a project, I found that the type hinting and autocomplete was sooo much superior, especially in cases when the codebase and its abstractions grew in size and layers. The types helped me understand how the data looks like even though it was multiple abstractions away from me, I could still visualize how the data looks like as paramter and what I should expect. This is what I miss in Ruby, it still requires some cognitize load to understand what type of value I am handling without using a debugger. This is also why Rubys autocomplete is lacking, because the dynamic typing is so complex that is it barely possible to accurately predict which type it is without executing it.
- Alifatisk 3y agoWhat an interesting article to read, I enjoyed reading it a lot. Regarding the following part: > I recently had a situation where we had to process 10k items, which included mapping them once, running each item item through a string template, and then serializing it all to JSON. This process took over 20 seconds. After doing benchmarking I found that all the time was just spent in ruby iteration time, so there was very little I could do to speed this process up. I am very curious to see if there was actually any optimizing that could be done. Things in Ruby can be done in sooo many ways that finding the most suitable path to approach it can be difficult. If would appreciate it a lot if the Author could recreate that environment and share it! (I'm thinking of isolating that part of the script)