amadeu01
03/28/2019, 2:24 PMapply and with. When should I use one over the other?thanksforallthefish
03/28/2019, 2:36 PMapply returns the receiver, ie the object you called apply on. for instance print("receiver".apply{ "something" }) prints receiver
with return the result of the operation, so print(with("receiver") { "something" }) prints somethingribesg
03/28/2019, 2:45 PMwith, I’m not sure why it exists at all. run is equal or better in all casesstreetsofboston
03/28/2019, 2:56 PMwith, it's usually better to refactor it into a private extension function.louiscad
03/29/2019, 11:50 PMwith and never used run on production code.elizarov
03/30/2019, 1:08 PM