This is why I think I should keep coding in Ruby.
Matz is getting people to weigh in on the |> operator over on the birdsite: https://twitter.com/yukihiro_matz/status/1139419951444271104
My thoughts, having it as an alias for dot operator is meh.
”Numbered parameter as the default block parameter” is interesting too, although it is still experimental.
Ruby 2.7 preview looks a bit similar to Elixir. However, they have worked on the pattern matching since 2012.
@veer66 it's actually not slow at all. Ruby has a copy-on-write strategy for arrays, so when you grab a subset it will reuse the original array with a different starting offset. Try running a test with different length arrays. On my laptop I get do `x[1..-1]` over 10 million times per second.
Ruby 2.7 — Enumerable#tally –
@veer66 imho, `while` and `until` show intent better. although I only use `until` to avoid code like `while x != 0` (which becomes `until x == 0`). Watch out for `until x !=0` (double negations), though
I guess you want something shorter than this?
p = Pathname.new("a/x/y.z")
A Mastodon instance for Rubyists & friends