Non-null objects, the Null Object pattern, and T.init
Namespace
rswhite4 at googlemail.com
Sat Jan 18 13:12:28 PST 2014
On Saturday, 18 January 2014 at 21:05:02 UTC, Walter Bright wrote:
> On 1/17/2014 7:05 AM, Michel Fortin wrote:
>> Some more thoughts.
>
> The postfix ? has parsing issues with ?: expressions.
>
> Aside from that, non-null is only one case of a universe of
> types that are subsets of other types. I'd prefer a more
> general solution.
Whats about a new storage class/modifier like
@safe_ref/@disable_null/@disallow_null?
----
class A { }
void test(@safe_ref A) {
}
A a;
test(a); // error
----
and maybe also:
----
@safe_ref A a; // error
----
More information about the Digitalmars-d
mailing list