nullable done right, was #Spec
BLS
windevguy at hotmail.de
Sun Nov 7 12:53:53 PST 2010
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?)
if s # same as "if s is not nil"
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
More information about the Digitalmars-d
mailing list