<div>On Sun, Nov 7, 2010 at 2:53 PM, BLS <span dir="ltr"><<a href="mailto:windevguy@hotmail.de">windevguy@hotmail.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

The following code does not fail at compile-time or run-time because the if statement proves that the call is safe:<br>class Foo<br><br>   def bar(s as String?)<br>       if s  # same as "if s is not nil"<br>           print Utils.countChars(s, c'x')<br>

<br><br>Please note the question mark "?" on String? forces a compile time check.<br><br>--As a side note<br>The sample snippet is written Cobra (not Boo).. CLR NET.<br>Cobra's DBC is heavily influenced by D !<br>

<br>Bearophile could be interested; so here the link<br><br><a href="http://cobra-language.com/docs/quality/" target="_blank">http://cobra-language.com/docs/quality/</a><br>Bjoern<br></blockquote></div><div><br></div>I've played with Cobra before, and I agree that Cobra does it very well.<div>

<br></div><div>I hope that D allows non-nullable types so that those seg faults/access violations can be prevented/caught easily at compile-time.</div><div>(for the sake of increasing the self-documenting ability of code, the safety of code, and even the quality code, as described in the link above)<br>

<br></div>