> > The only way I've found so far to do static binding like you are talking > about is using string mixins. I need to rethink stuff a bit, but mixins might be the solution.
> My port of Atl's window classes uses a MFC > like message map: > > mixin messageMap!( > msgRangeHdlr!(WM_MOUSEFIRST, WM_MOUSELAST, "wmMouseEvents"), > msgHdlr!(WM_PAINT, "wmPaint"), > msgHdlr!(WM_SIZE, "wmSize"), > msgHdlr!(WM_KEYUP, "wmKeyUp"), > msgHdlr!(WM_CHAR, "wmChar"), > > msgHdlr!(WM_SHOWWINDOW, "wmShow"), > msgHdlr!(WM_CLOSE, "wmClose"), > msgHdlr!(WM_CREATE, "wmCreate") > ); > > Having to put the classes method in a string is a bit ugly, but without > c++ style pointer to members I don't see any other way of doing it. > > If you want to have a look in more detail: > > http://www.sstk.co.uk/atlWinD.php The zip 404ed > > >> Kind of related: >> If you delete an object and later create a new object, what are the >> chances >> they are located on the >> same place (deleted.ptr is new.ptr) ? >> Does the garbage collector try to reuse locations or is it the opposite >> (or >> random) ? > > Dunno, but the full source code is in dmd zip @ > src\druntime\src\gc\basic\gcx.d if you are really that interested. nah :) bit beyond me anyway I'm afraid.