4 ms·
For me I think there are only two major things happening between 2.5 let's say and 3.0: - Keyword arguments - where there is no way around, you have to change
by gls2ro 5y ago
For me I think there are only two major things happening between 2.5 let's say and 3.0:
- 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?
- thr0wawayf00 5y ago> Keyword arguments - where there is no way around, you have to change them, upgrade gems... 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.
- deleted 5y ago[deleted]
- lewispb 5y agoThis explains the breaking change: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/ https://www.ruby-lang.org/en/news/2019/12/12/separation-of-p...
- kayodelycaon 5y ago* RBS (Types) * 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 )
- gls2ro 5y agoFor RBS I don't yet have a case, but thank you for reminding me about single line definitions, case...in, and destructing arrays and hashes. I should play a bit with them and see if they provide any help to write more readable code.
- kayodelycaon 5y agoI usually do 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 end