4 ms·
A lot of the differences are based around choosing what is optimal, instead of what is similar to Ruby. Without context, I'd prefer `property` over `attr_access
by prh8 10y ago
A lot of the differences are based around choosing what is optimal, instead of what is similar to Ruby. Without context, I'd prefer `property` over `attr_accessor`.
As for the effect on porting code, it's still very easy to port code. I ported over ActiveSupport's Inflector module(s), and approximately 75% of the code was untouched, 20% was minor tweaks (i.e. single to double quotes), and 5% required actual changing. It was a rather quick process.
If curious, https://github.com/phoffer/inflector.cr https://github.com/phoffer/inflector.cr
- vidarh 10y agoWithout context, "attr_accessor" to me appears closer in meaning to what it actually means in Ruby. Maybe it's meaning in Crystal is sufficiently different to make "property" make more sense. In Ruby, after all, it literally creates accessor methods, it does not create a property.