News for hackers. Stuff that matters.
Re:Show HN: I Wrote a Book on Java by kaba0 on Monday September 23, 2024 @04:11PM (#41629964)
To a degree, yes, that’s possible. But leaking a private type over module boundaries is bad form, so a better (though possibly over engineered solution) would be to have a separate public interface, implemented by the private record type, and the static function would have that interface as return type.
Re:Show HN: I Wrote a Book on Java by enugu on Monday September 23, 2024 @09:23PM (#41632253)
Why is it bad form to expose a record type only via custom functions and not its field accessors? Isn't this just like exposing a more usual object with its public functions and private functions remain inaccessible?