News for hackers. Stuff that matters.
Re:Stop Writing Dead Programs (Transcript) by theamk on Wednesday October 19, 2022 @01:07PM (#33265023)
In many (most?) languages chaining leads to longer lines unless programmer makes an extra effor to break them. Compare:

     user = manager.getUser()
     mobile = user.getPhone(PhoneType.mobile)
     area = mobile.getAreaCode()
vs

     area = manager.getUser().getPhone(PhoneType.mobile).getAreaCode()
Re:Stop Writing Dead Programs (Transcript) by hrbf on Wednesday October 19, 2022 @02:37PM (#33266178)
Good example and exactly what I meant. Having each call on its own line doesn’t solve anything if you also nest the calls.
Re:Stop Writing Dead Programs (Transcript) by Sohcahtoa82 on Wednesday October 19, 2022 @04:56PM (#33267825)
what about...

    area = manager
           .getUser()
           .getPhone(PhoneType.mobile)
           .getAreaCode();
I see this form a lot in Java and Kotlin code, especially in Kotlin where a single function is just assigned to a chain of functions like the one above.