logoalt Hacker News

lenkitelast Friday at 6:20 PM1 replyview on HN

The first example given is not at all convincing. Its is clear as the sky that loading the config file should be be a separate function of its own. Coupling sending HTTP requests with it makes no sense.

The second example "erasure of mutability" makes more sense. But this effectively makes it a Rust-specific pattern.


Replies

dtdynastylast Friday at 9:32 PM

It's essentially an inline function with only 1 client. Can be a preference for inline readability and automatically enforces there are no other clients of the "function".