digitalmars.D - Function pointers and delegates unifying
- dyh inbox.lv (7/7) Dec 29 2005 In some old D newsgroup archives (sep 2003) I saw questions about unifyi...
- Walter Bright (4/12) Dec 29 2005 Yes.
- John Reimer (4/23) Dec 29 2005 Can we name the next version 2.0, then? ;)
- dyh inbox.lv (3/7) Dec 30 2005 Thanks for reply, Walter. This is the ultimate feature that I miss in c+...
-
Stewart Gordon
(7/20)
Dec 30 2005
- Bruno Medeiros (10/20) Dec 30 2005 Let me just see if I got this right (because I never quite understood
- Stewart Gordon (11/30) Jan 03 2006 If I'm correctly guessing how it will work, then the function that will
- David Medlock (6/47) Jan 03 2006 I just wish for function to delegate conversion.
In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it. Is that mean that will be possible to use nonstatic class methods as winapi callbacks, window procedures, etc.? How it's going, will it be anytime soon? DYH.
Dec 29 2005
<dyh inbox.lv> wrote in message news:dp1qe0$11al$1 digitaldaemon.com...In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it.Yes.Is that mean that will be possible to use nonstatic class methods as winapi callbacks, window procedures, etc.?Yes.How it's going, will it be anytime soon?It'll be a 2.0 thing.
Dec 29 2005
Walter Bright wrote:<dyh inbox.lv> wrote in message news:dp1qe0$11al$1 digitaldaemon.com...Hmmm, that's the feature I've been missing for so long!In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it.Yes.Is that mean that will be possible to use nonstatic class methods as winapi callbacks, window procedures, etc.?Yes.Can we name the next version 2.0, then? ;) -JJRHow it's going, will it be anytime soon?It'll be a 2.0 thing.
Dec 29 2005
In article <dp1tt1$13og$1 digitaldaemon.com>, Walter Bright says...Thanks for reply, Walter. This is the ultimate feature that I miss in c++. DYH.Is that mean that will be possible to use nonstatic class methods as winapi callbacks, window procedures, etc.?Yes.
Dec 30 2005
Walter Bright wrote:<dyh inbox.lv> wrote in message news:dp1qe0$11al$1 digitaldaemon.com...<snip> It would be interesting to see how this is going to work. When you try to convert a delegate to a function pointer, will it wrap the delegate in an internal function, or what? I can see there being more garbage collection issues to think about.... Stewart.In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it.Yes.Is that mean that will be possible to use nonstatic class methods as winapi callbacks, window procedures, etc.?Yes.
Dec 30 2005
Walter Bright wrote:<dyh inbox.lv> wrote in message news:dp1qe0$11al$1 digitaldaemon.com...Let me just see if I got this right (because I never quite understood this when I read the D spec): Is this unification the ability the use delegates as function pointers and vice-versa? Also, Walter said on another thread that this requires: "... runtime thunk generation and some mucking about with the gc." What issues to the GC does this bring? At first sight, it doesn't seem to me any different from the creation (and memory allocation) of the other anonymous entities we have already.In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it.Yes.
Dec 30 2005
Bruno Medeiros wrote:Walter Bright wrote:Yes.<dyh inbox.lv> wrote in message news:dp1qe0$11al$1 digitaldaemon.com...Let me just see if I got this right (because I never quite understood this when I read the D spec): Is this unification the ability the use delegates as function pointers and vice-versa?In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it.Yes.Also, Walter said on another thread that this requires: "... runtime thunk generation and some mucking about with the gc." What issues to the GC does this bring? At first sight, it doesn't seem to me any different from the creation (and memory allocation) of the other anonymous entities we have already.If I'm correctly guessing how it will work, then the function that will be generated will hold a pointer to an object that may be allocated on the heap. As such, it will be necessary to make sure the GC follows this pointer. Moreover, since the main purpose of converting delegates to function pointers is to communicate with foreign APIs, the problem of pointers into the GC heap held by foreign code crops up again. http://www.digitalmars.com/drn-bin/wwwnews?D/26273 Stewart.
Jan 03 2006
Stewart Gordon wrote:Bruno Medeiros wrote:I just wish for function to delegate conversion. I don't see the benefit of delegate to function conversion. It's problematic at best, and delegates are superior unless you are accessing C code. -DavidMWalter Bright wrote:Yes.<dyh inbox.lv> wrote in message news:dp1qe0$11al$1 digitaldaemon.com...Let me just see if I got this right (because I never quite understood this when I read the D spec): Is this unification the ability the use delegates as function pointers and vice-versa?In some old D newsgroup archives (sep 2003) I saw questions about unifying function pointers and delegates. Walter mentioned that he planning to implement some kind of thunking for it.Yes.Also, Walter said on another thread that this requires: "... runtime thunk generation and some mucking about with the gc." What issues to the GC does this bring? At first sight, it doesn't seem to me any different from the creation (and memory allocation) of the other anonymous entities we have already.If I'm correctly guessing how it will work, then the function that will be generated will hold a pointer to an object that may be allocated on the heap. As such, it will be necessary to make sure the GC follows this pointer. Moreover, since the main purpose of converting delegates to function pointers is to communicate with foreign APIs, the problem of pointers into the GC heap held by foreign code crops up again. http://www.digitalmars.com/drn-bin/wwwnews?D/26273 Stewart.
Jan 03 2006