www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [bindings/win32] Migration from typedef

reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
Now that typedef is deprecated in D2, how should libraries that 
support both D1 and D2 adjust? Should it be simply changed to an 
alias, or replaced with a string mixin hack? What's the impact of 
changing typedefs to aliases in a widely-used library?
Dec 21 2011
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-12-21 23:56, Vladimir Panteleev wrote:
 Now that typedef is deprecated in D2, how should libraries that support
 both D1 and D2 adjust? Should it be simply changed to an alias, or
 replaced with a string mixin hack? What's the impact of changing
 typedefs to aliases in a widely-used library?

I was hoping that D2 would allow typedefs in a version statement, but that's not the case. D2 still recognizes "typedef" so it's not the same problem as with D1 and the new D2 keywords. -- /Jacob Carlborg
Dec 21 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I'd like to know this too. Currently wxd won't link if I change a
typedef to an alias due to multiple definitions.
Dec 22 2011
prev sibling next sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Wednesday, 21 December 2011 at 22:56:36 UTC, Vladimir 
Panteleev wrote:
 Now that typedef is deprecated in D2, how should libraries that 
 support both D1 and D2 adjust? Should it be simply changed to 
 an alias, or replaced with a string mixin hack? What's the 
 impact of changing typedefs to aliases in a widely-used library?

Here's a proposed patch: http://dump.thecybershadow.net/3c5de02d8929799da17b3dbeabfa3576/typedef.diff The TypeDef template is defined in basetsd.d (third file in diff). Seems to work with D1 and D2. Perhaps we should wait for the upcoming TypeDef library type in Phobos for D2? I'll commit it if there are no objections/suggestions...
Jan 06 2012
prev sibling next sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Saturday, 7 January 2012 at 05:22:47 UTC, Vladimir Panteleev 
wrote:
 On Wednesday, 21 December 2011 at 22:56:36 UTC, Vladimir 
 Panteleev wrote:
 Now that typedef is deprecated in D2, how should libraries 
 that support both D1 and D2 adjust? Should it be simply 
 changed to an alias, or replaced with a string mixin hack? 
 What's the impact of changing typedefs to aliases in a 
 widely-used library?

Here's a proposed patch: http://dump.thecybershadow.net/3c5de02d8929799da17b3dbeabfa3576/typedef.diff The TypeDef template is defined in basetsd.d (third file in diff). Seems to work with D1 and D2. Perhaps we should wait for the upcoming TypeDef library type in Phobos for D2? I'll commit it if there are no objections/suggestions...

Committed (revision 372).
Jan 08 2012
prev sibling parent Gerrit Wichert <gwichert yahoo.com> writes:
On 22.12.2011 12:28, Andrej Mitrovic wrote:
 I'd like to know this too. Currently wxd won't link if I change a
 typedef to an alias due to multiple definitions.

I've had the same problems here on my linux box + some others. But i've just finished fixing them and DMD 2.057actually successfully builds the little testing app i'm developing to become more acquainted with D. It is tested under Linux 32 bit only (OpenSuse 11.4 + Open Suse 12.1/64 using -m32) but i think it should also work on Windows. if you want to give it a try, checkout the 'dmd257linux' branch from https://github.com/gwichert/wxd Gerrit
Jan 10 2012