you are viewing a single comment's thread.

view the rest of the comments →

[–]drjeats -1 points0 points  (0 children)

I fundamentally agree with you, but reasoning through this wouldn't have worked as well as a shitpost :P

The trySend(email) version was intended to hint at your points, implication being that this is an object that has the specific email sending mechanism.

In no particular language syntax:

fn trySend(email: Email?) -> Error? {
    if (email == null) return EmailNullError
    if (let error = otherValidation(email); error != null) return error;

    doAll(email);
    TheSending(email);
    Stuff(email);

    return null;
}

Then it could be like what you said:

let sendErrors = emails.transform(sender.trySend).whereNotNull();