5 ms·
Whoa, interesting. I didn't know Kotlin had all those constructs. In Virgil, a method on an object (or ADT) can declare its return type as "this". Then the met
by titzer 4y ago
Whoa, interesting. I didn't know Kotlin had all those constructs.
In Virgil, a method on an object (or ADT) can declare its return type as "this". Then the method implicitly returns the receiver object. That trick is very useful to allow a chain of calls such as object.foo().bar().baz(). I find it readable and easy to explain:
https://github.com/titzer/virgil/blob/master/doc/tutorial/ReturnThis.md https://github.com/titzer/virgil/blob/master/doc/tutorial/Re...