News for hackers. Stuff that matters.
Re:Ruby 2.6 by tyre on Monday December 24, 2018 @12:33PM (#18753159)
Not having `nil` is soooo nice. I can't count the number of `Runtime Error`s because some method isn't defined on `NilClass` that have blown things up in weird edge cases.

Knowing exactly what types a method takes and the compiler catching incorrect uses before the code ever runs saves a lot of frustration. Another thing I've enjoyed in Rust include `match` clauses forcing me to define branches for any possibility, especially for `Result` structs. In ruby this isn't possible because anything can be anything.

Re:Ruby 2.6 by ken on Monday December 24, 2018 @01:58PM (#18753652)
There's got to be more to it than "has / doesn't have nil". Lisp has nil, and I rarely if ever see an analogous error there, or even a type error.

I have a hunch that single/static dispatch is what tends to cause more problems than merely the presence of nil. It's not nil, but how you use it.

Re:Ruby 2.6 by akjha on Tuesday December 25, 2018 @03:10AM (#18756523)
"It's not nil, but how you use it."

Can you elaborate on how multi-dispatch reduces the issue of nil/null?

I also use static type (typescript) to prevent issues with nil and would like to know how I can achieve the same in a dynamic language.

Re:Ruby 2.6 by jashmatthews on Wednesday December 26, 2018 @05:25AM (#18761519)
You can prevent nil errors using contracts like in Eiffel and Clojure.