Jacob Carlborg:

I think nil (null) works quite nicely in Ruby. nil is a singleton instance of the NilClass class. Since it's an object you can call methods on it, like to_s, which returns an empty string. It works quite well when doing web development with Ruby on Rails. If you're trying to render something that's nil you'll get nothing, instead of crashing that whole page. Sure, there might be a small icon or similar that isn't rendered but that's usually a minor detail. If the page is working and main content is rendered that's preferable.

Walter is arguing against this solution in D.
While that can be OK for Ruby used for web development, for a statically typed language meant for safe coding styles, there are better type-based solution to that problem.

Bye,
bearophile

Reply via email to