Hacker News new | past | comments | ask | show | jobs | submit login

Option isn't a safeguard, it expresses missing values in a way that doesn't violate the Liskov Substitution Principle, otherwise you might as well work with `null` along with some syntactic sugar.

And they are different because the types say so. By allowing them to be equal, you're implicitly converting one into the other. That's weak typing by definition, a hole in the type system that can be abused.

So why have types at all? Dynamic typing is much more convenient and Clojure deals with nulls by conventions just fine.




>Option isn't a safeguard, it expresses missing values in a way that doesn't violate the Liskov Substitution Principle, otherwise you might as well work with `null` along with some syntactic sugar.

Again, it's the use that makes it a safe guard, not its ontology.

>And they are different because the types say so. By allowing them to be equal, you're implicitly converting one into the other.

Which is fine sometimes, when you explicitly need to do it a lot.

>That's weak typing by definition, a hole in the type system that can be abused.

Any examples of how A = Just A can be abused in any meaningful way?

>So why have types at all?

Because I don't believe in the Slippery Slope fallacy, and some types are better than no types at all, but exceptions can be OK too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: