digitalmars.D - nullable done right, was #Spec
The following code does not fail at compile-time or run-time because the
if statement proves that the call is safe:
class Foo
def bar(s as String?)
print Utils.countChars(s, c'x')
Please note the question mark "?" on String? forces a compile time check.
--As a side note
The sample snippet is written Cobra (not Boo).. CLR NET.
Cobra's DBC is heavily influenced by D !
Bearophile could be interested; so here the link
http://cobra-language.com/docs/quality/
Bjoern
Nov 07 2010
On Sun, Nov 7, 2010 at 2:53 PM, BLS <windevguy hotmail.de> wrote:
The following code does not fail at compile-time or run-time because the if
statement proves that the call is safe:
class Foo
def bar(s as String?)
print Utils.countChars(s, c'x')
Please note the question mark "?" on String? forces a compile time check.
--As a side note
The sample snippet is written Cobra (not Boo).. CLR NET.
Cobra's DBC is heavily influenced by D !
Bearophile could be interested; so here the link
http://cobra-language.com/docs/quality/
Bjoern
I've played with Cobra before, and I agree that Cobra does it very well.
I hope that D allows non-nullable types so that those seg faults/access
violations can be prevented/caught easily at compile-time.
(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)
Nov 07 2010








Jimmy Cao <jcao219 gmail.com>