On Fri, 11 May 2012 14:56:45 -0400, Mehrdad <wfunct...@hotmail.com> wrote:

Okay, I just tried changing "alias void*" to "alias Typedef(void*)", and also "alias HANDLE" to "alias Typedef(HANDLE)", etc.

First error I got?

        HMODULE hAdvapi32 = null;
        ...\src\phobos\std\internal\windows\advapi32.d(32):
        Error:
cannot implicitly convert expression (null) of type typeof(null) to Typedef!(Typedef!(void*,null),Typedef(null))


Which makes sense, except that I'm not sure how to solve it correctly in general... I think it's a bigger problem than it looks, since 'null' would need to be convertible to everything that's nullable...

This is a frequent problem with null. Since null is its own type now, it doesn't play nice with custom types, only builtins enjoy special treatment for null.

ideas?

probably something like opBool:

struct S
{
  int x;
  static S opNull() { return S(0);}
}

S s = null; // equivalent to S(0);

-Steve

Reply via email to