3 ms·
With all other object oriented structures you would think that you want to do something with the mylist, thus you would first write down mylist. In Ruby I thus
by oezi 3y ago
With all other object oriented structures you would think that you want to do something with the mylist, thus you would first write down mylist.
In Ruby I thus often write something such as:
if mylist.empty?.!
Because my line of thinking goes from the object to a function or attribute and then chains further along. Calling the `.!` method on the returned boolean object is very nice, because I don't have to go back to before mylist and insert the !-operator there.
- abenga 3y agoI haven't written any Ruby. Maybe one gets used to this after some time, but this honestly looks like it will enable you to write extremely clever and succinct code that makes perfect sense at the time, but a chore for anyone else to read and grok quickly (including the writer themselves a few weeks later). I could be wrong though.