Hacker News new | ask | show | jobs
by groestl 61 days ago
> why would you ever design a program where a change in one place affects the other

If that would be possible, there would be no function signatures.

1 comments

Exactly. It's painfully easy to break duck typed functional code in confusing ways by subtly changing the semantics of a higher order library function that's used all over the codebase. I love lisps but IMO in general not having static types is on par with not having a debugger. It's probably my only real complaint about standard scheme.
> by subtly changing the semantics of a higher order library function

Why would you do that? Take common lisps, most of the functions has been standardized for ages. It’s like saying by slightly adjusting the rules of addition, you can break maths.

Something that is going to be used all over the codebase is basically axiomatic and needs to be written and modified carefully.

> Why would you do that?

Are you really asking why someone would find themselves needing to tweak the edge case semantics of a widely used function in a large project?

> needs to be written and modified carefully.

But notably compile time static type checking greatly reduces the risks involved. That's all I was trying to say.

> Are you really asking why someone would find themselves needing to tweak the edge case semantics of a widely used function in a large project?

If you do this and breaks the assumptions of the interface, it’s just recklessness. You don’t go and tweak functions without fully understanding the rules it established and how those rules are treated as axioms somewhere else.

> But notably compile time static type checking greatly reduces the risks involved

This is usually an excuse to not fully check the assumptions in a given piece of code. Like tbe warnings will be enough to take care of any issues. Type checking is not software correctness. I’ve seen badly defined type, type erasures, and various other issues that negated any value brought by the type system.