digitalmars.D - Function name as text
- Craig Black (25/25) Dec 05 2007 I have been considering porting some C++ code to D. One of the classes ...
- Jarrett Billingsley (16/41) Dec 05 2007 template dispatch(char[] methodName)
- Craig Black (3/3) Dec 05 2007 Thanks for the idea. I came up with something similar. (See my post af...
- Craig Black (3/6) Dec 05 2007 Err, I mean wrap the name of the method in a string.
- Craig Black (9/9) Dec 05 2007 OK I think it's possible with mixins but the syntax is ugly. It would b...
- Bill Baxter (6/19) Dec 05 2007 My understanding is that that is exactly what macros are going to do.
- Jarrett Billingsley (16/35) Dec 05 2007 Ooooh.
- Craig Black (8/46) Dec 07 2007 It would be very cool if macros worked like this. I think it would actu...
- Bill Baxter (8/40) Dec 05 2007 There probably isn't a way to do it right now without using a string
- Craig Black (8/48) Dec 05 2007 I guess that's not so bad. It would be.
- Bill Baxter (3/58) Dec 05 2007 Or you could just run the C preprocessor on your source code. Mwahahaha....
- Don Clugston (3/56) Dec 06 2007 Or you could use an alias template parameter, to give the syntax:
- Bill Baxter (4/65) Dec 06 2007 Really? Can you take the stringof an alias parameter and get back
- Don Clugston (21/89) Dec 06 2007 Unfortunately it's not quite so simply, since there are so many bugs in
- Craig Black (4/94) Dec 06 2007 I ran into this same thing with stringof. Are you sure that this is a b...
- Don Clugston (6/100) Dec 06 2007 It's hard to say. stringof was originally a 'hidden feature'/easter egg ...
- Craig Black (4/70) Dec 06 2007 Sorry to be picky, but getting back the string "foo.bar" is not sufficie...
- Jarrett Billingsley (4/6) Dec 06 2007 Unfortunately not, since passing foo.bar to an alias parameter will get ...
I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. capture the name of the function. The good (and bad) thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?
Dec 05 2007
"Craig Black" <cblack ara.com> wrote in message news:fj714p$2u7b$1 digitalmars.com...I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. capture the name of the function. The good (and bad) thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?template dispatch(char[] methodName) { Event dispatch(T)(T thing) { Event ret; ret.name = T.stringof ~ "." ~ methodName; ret.func = mixin("&thing." ~ methodName); return ret; } } Now you can use it like: Event event = dispatch!("bar")(foo); It's kind of backwards-looking, but it's probably the best you can do without macros/static params.
Dec 05 2007
Thanks for the idea. I came up with something similar. (See my post after yours.) Again, it would be nice if I didn't have to wrap the name of the instance in a string.
Dec 05 2007
"Craig Black" <cblack ara.com> wrote in message news:fj7683$7n9$1 digitalmars.com...Thanks for the idea. I came up with something similar. (See my post after yours.) Again, it would be nice if I didn't have to wrap the name of the instance in a string.Err, I mean wrap the name of the method in a string.
Dec 05 2007
OK I think it's possible with mixins but the syntax is ugly. It would be Event event = mixin(dispatch("&foo.bar")); Which leads me to an idea that has probably been proposed before. It would be nice if I could shorten this to simply Event event = dispatch(&foo.bar); There may be reasons why this syntax would be difficult to achieve, but I think it would be worthwhile if we could. Thoughts? -Craig
Dec 05 2007
Craig Black wrote:OK I think it's possible with mixins but the syntax is ugly. It would be Event event = mixin(dispatch("&foo.bar")); Which leads me to an idea that has probably been proposed before. It would be nice if I could shorten this to simply Event event = dispatch(&foo.bar); There may be reasons why this syntax would be difficult to achieve, but I think it would be worthwhile if we could. Thoughts?My understanding is that that is exactly what macros are going to do. Define dispatch as a macro, then its arguments get passed as strings. I think the main issue is just working out the grammar and all the various compiler bits to make it work. --bb
Dec 05 2007
"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj76f5$7ou$2 digitalmars.com...Craig Black wrote:Ooooh. macro dispatch(&x.y) { Event(y.stringof, &x.y) } Or something like that. Then Event e = dispatch(&foo.bar); turns into Event e = Event("Foo.bar", &foo.bar); Heck, you could remove the requirement for the ugly ampersand. macro dispatch(x.y) { Event(y.stringof, &x.y) }OK I think it's possible with mixins but the syntax is ugly. It would be Event event = mixin(dispatch("&foo.bar")); Which leads me to an idea that has probably been proposed before. It would be nice if I could shorten this to simply Event event = dispatch(&foo.bar); There may be reasons why this syntax would be difficult to achieve, but I think it would be worthwhile if we could. Thoughts?My understanding is that that is exactly what macros are going to do. Define dispatch as a macro, then its arguments get passed as strings. I think the main issue is just working out the grammar and all the various compiler bits to make it work. --bb
Dec 05 2007
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:fj79a1$d2l$1 digitalmars.com..."Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj76f5$7ou$2 digitalmars.com...It would be very cool if macros worked like this. I think it would actually have to be macro dispatch(&x.y) { Event(typeof(x).stringof ~ "." ~ y.stringof, &x.y) }Craig Black wrote:Ooooh. macro dispatch(&x.y) { Event(y.stringof, &x.y) } Or something like that. Then Event e = dispatch(&foo.bar); turns into Event e = Event("Foo.bar", &foo.bar); Heck, you could remove the requirement for the ugly ampersand. macro dispatch(x.y) { Event(y.stringof, &x.y) }OK I think it's possible with mixins but the syntax is ugly. It would be Event event = mixin(dispatch("&foo.bar")); Which leads me to an idea that has probably been proposed before. It would be nice if I could shorten this to simply Event event = dispatch(&foo.bar); There may be reasons why this syntax would be difficult to achieve, but I think it would be worthwhile if we could. Thoughts?My understanding is that that is exactly what macros are going to do. Define dispatch as a macro, then its arguments get passed as strings. I think the main issue is just working out the grammar and all the various compiler bits to make it work. --bb
Dec 07 2007
Craig Black wrote:I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. capture the name of the function. The good (and bad) thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 05 2007
"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically. Thanks for the help.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. to capture the name of the function. The good (and bad) thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 05 2007
Craig Black wrote:"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could just run the C preprocessor on your source code. Mwahahaha... --bbCraig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically. Thanks for the help.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. to capture the name of the function. The good (and bad) thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 05 2007
Craig Black wrote:"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. to capture the name of the function. The good (and bad) thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 06 2007
Don Clugston wrote:Craig Black wrote:Really? Can you take the stringof an alias parameter and get back "foo.bar" ? If so then nifty! --bb"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. In C++ I had a macro called DISPATCH that used the stringize thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 06 2007
Bill Baxter wrote:Don Clugston wrote:Unfortunately it's not quite so simply, since there are so many bugs in .stringof. I'm unable to get the 'foo'. ---- class Foo { void bar(int d) {} } void GetName(alias F)() { pragma(msg, (&F).stringof); // prints "& bar" } void main() { GetName!(Foo.bar); } ---- I have however done this previously using .mangleof to retrieve the fully qualified name. The behaviour with alias template parameters was one of the parts of my NameOf module which didn't get into .stringof. Sure would be nice if F.stringof worked.Craig Black wrote:Really? Can you take the stringof an alias parameter and get back "foo.bar" ? If so then nifty! --bb"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. In C++ I had a macro called DISPATCH that used the stringize thing about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 06 2007
"Don Clugston" <dac nospam.com.au> wrote in message news:fj8j1p$2per$1 digitalmars.com...Bill Baxter wrote:I ran into this same thing with stringof. Are you sure that this is a bug? Has it been officially reported?Don Clugston wrote:Unfortunately it's not quite so simply, since there are so many bugs in .stringof. I'm unable to get the 'foo'. ---- class Foo { void bar(int d) {} } void GetName(alias F)() { pragma(msg, (&F).stringof); // prints "& bar" } void main() { GetName!(Foo.bar); } ---- I have however done this previously using .mangleof to retrieve the fully qualified name. The behaviour with alias template parameters was one of the parts of my NameOf module which didn't get into .stringof. Sure would be nice if F.stringof worked.Craig Black wrote:Really? Can you take the stringof an alias parameter and get back "foo.bar" ? If so then nifty! --bb"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. In C++ I had a macro called DISPATCH that used the stringize operator about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 06 2007
Craig Black wrote:"Don Clugston" <dac nospam.com.au> wrote in message news:fj8j1p$2per$1 digitalmars.com...It's hard to say. stringof was originally a 'hidden feature'/easter egg that didn't get mentioned in the changelog. It's in the docs, but it behaves quite differently from documented, except in simple cases.Bill Baxter wrote:I ran into this same thing with stringof. Are you sure that this is a bug?Don Clugston wrote:Unfortunately it's not quite so simply, since there are so many bugs in .stringof. I'm unable to get the 'foo'. ---- class Foo { void bar(int d) {} } void GetName(alias F)() { pragma(msg, (&F).stringof); // prints "& bar" } void main() { GetName!(Foo.bar); } ---- I have however done this previously using .mangleof to retrieve the fully qualified name. The behaviour with alias template parameters was one of the parts of my NameOf module which didn't get into .stringof. Sure would be nice if F.stringof worked.Craig Black wrote:Really? Can you take the stringof an alias parameter and get back "foo.bar" ? If so then nifty! --bb"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. In C++ I had a macro called DISPATCH that used the stringize operator about C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bbHas it been officially reported?Not that I know of. Even most of the examples in the docs don't work as advertised, so there hasn't been much motivation to report these secondary cases.
Dec 06 2007
"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj8dlo$2fuj$2 digitalmars.com...Don Clugston wrote:Sorry to be picky, but getting back the string "foo.bar" is not sufficient. I need the name of the class, not the instance name.Craig Black wrote:Really? Can you take the stringof an alias parameter and get back "foo.bar" ? If so then nifty! --bb"Bill Baxter" <dnewsgroup billbaxter.com> wrote in message news:fj769h$7ou$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Craig Black wrote:I guess that's not so bad. It would be. Foo *foo = new Foo; Event event = dispatch(&foo.bar, "Foo.bar"); That is probably easier on the eyes than the mixin syntax. It stilll would be cool if the compiler could somehow build the name automatically.I have been considering porting some C++ code to D. One of the classes I would have to port is an event queue class where each event on the queue has a delegate and a text string that points to the function name that the delegate refers to. The function name is used to visualize the event queue for run-time debugging purposes. It is important to capture both the class name and the function name as text. In C++ I had a macro called DISPATCH that used the stringize operator C++ in this case is that when specifying a pointer to a member, you must fully qualify the function name, so you would have something like this. class Foo { public: void bar() {} }; Foo *foo = new Foo; Event event = DISPATCH(foo, &Foo::bar); Using the stringize operator, the DISPATCH macro could capture the text string "Foo::bar" as well as the member function pointer. Here is the equivalent code in D.. Foo foo = new Foo; Event event = dispatch(&foo.bar); Which is much more elegant, except that I can't figure out a way to capture the name of the function and it's class. I tried fiddling with the stringof operator but that doesn't seem to work. Any ideas?There probably isn't a way to do it right now without using a string mixin, which uglies things up on the calling side: Event event = mixin(dispatch("&foo.bar")); Macros are supposed to give us a way to clean that up. But for now you're probably better off just passing the name separately like dispatch(&foo.bar, "foo"); --bb
Dec 06 2007
"Don Clugston" <dac nospam.com.au> wrote in message news:fj8ap7$29k9$1 digitalmars.com...Or you could use an alias template parameter, to give the syntax: Event event = dispatch!(foo.bar);Unfortunately not, since passing foo.bar to an alias parameter will get you an alias to the method bar instead of the entire expression. :\
Dec 06 2007