A lot of the syntax feels like hacks because Ruby syntax is rather permissive and finding pattens that don’t collide increasingly difficult.
Definitely has me a little grumbly, but I’ll get used to it eventually. Already loving _1.
A lot of the syntax feels like hacks because Ruby syntax is rather permissive and finding pattens that don’t collide increasingly difficult.
Definitely has me a little grumbly, but I’ll get used to it eventually. Already loving _1.
- Keyword arguments - where there is no way around, you have to change them, upgrade gems...
- Everything else is optional. Code that is written in 2.5 mostly runs on 3.0
Also, I recently updated a Rails app from 2.7 to 3.0 and no code change is required.
I am asking as I am trying to use new syntax in my daily code so maybe I am missing something.
What is the new syntax that you discovered in 3.0 that made your head spin?
How does the keyword arguments change break old gems? I understood the new syntax to be optional in the case of not needing to repeat keys and values.
* single line method definitions (def ... = ...)
* case...in
* pin operator
* rightward assignment (42 => int)
* use of the above to destruct arrays and hashes ( x => { b: foo } ; foo #=> 2 )
I should play a bit with them and see if they provide any help to write more readable code.
def red; “red”; end
The new syntax is a bit cleaner def red = “red”
But it looks too much like def color name = “red”
name
endBut now that I think about it, yeah, even looking only at pattern matching there is a lot of new syntax going on.