News for hackers. Stuff that matters.
Re:Don't Be Afraid of Types by noduerme on Saturday March 22, 2025 @02:50AM (#43444036)
The only thing with anonymous functions is, when the boss says "please include every user's middle initial", you need to go find every instance of an inline function that resembles this. Consolidating that function in a getter in a class object called Person or User or Customer is a lot nicer.
Re:Don't Be Afraid of Types by tossandthrow on Saturday March 22, 2025 @03:41AM (#43444215)
This is more a question about architecture.

But one thing is certain: When you have that one function that is used 165 times throughout the code base, having a type checker is certainly going to help you when you add in the users middle initial.

Re:Don't Be Afraid of Types by nottorp on Saturday March 22, 2025 @10:19AM (#43445772)
> This is more a question about architecture.

In an ideal world :)

In the real world the customer doesn't know what they want and you can't fully guess what they want or need ahead of time no matter how many diagrams you draw.

Incidentally, one of the few good things that came out of the "agile" religion.

Re:Don't Be Afraid of Types by tossandthrow on Saturday March 22, 2025 @10:55AM (#43446096)
You are completely right!

And the exact point I tried to communicate.

When you decide to have loose architectural structures, you might allow just writing these types of functions adhoc.

The further you go in the project, the more your strengthen the architecture, where needed.