On Saturday, September 10, 2011 17:11:56 Mehrdad wrote:
> I just realized some of my code broke because of the (apparent?) changes
> to typedef.
> 
> I had something like:
> 
>     extern(Windows) void Foo(HANDLE h);
> 
>     const HANDLE h = CreateFile(...);
>     Foo(h);
> 
> which now broke because Foo's parameter can no longer be const (since
> HANDLE is now an alias for void*, and so const HANDLE means
> const(void*), which can't be cast to void*).
> 
> Obviously, I can make the variable non-const to solve the problem, but
> like, was the change to typedef really necessary? Is there a plan to get
> around problems like these in the long term?

typedef is being removed from the language entirely. In its place we currently 
have alias and we will have a struct of some kind in Phobos (probably called 
Typedef or TypeDef) which will allow for something similar to typedef but with 
a finer grain of control over which conversions are implicit and which are 
explicit. I believe that typedef stuff was removed from Phobos in several 
places recently in preparation for the removal of typedef from the language. 
If that's causing problems, then they need to be identified and sorted out one 
way or another. Once we have an implementation of Typedef in Phobos is 
probably when we'll actually deprecate typedef.

- Jonathan M Davis

Reply via email to