On Friday, 6 March 2020 at 15:19:39 UTC, Adam D. Ruppe wrote:
On Friday, 6 March 2020 at 15:05:56 UTC, wjoe wrote:
But didn't like the string part and that's when I introduced
the alias fn because I figured maybe it's possible to do
something like:
factory.dispatch!(Bitmap.load)(handle,
On Friday, 6 March 2020 at 15:05:56 UTC, wjoe wrote:
But didn't like the string part and that's when I introduced
the alias fn because I figured maybe it's possible to do
something like:
factory.dispatch!(Bitmap.load)(handle, path);
and get the Bitmap part from that alias and hence save the
On Friday, 6 March 2020 at 14:14:04 UTC, Adam D. Ruppe wrote:
On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer
wrote:
Adam's way doesn't work either, because the call doesn't use
the alias, but just instantiates opDispatch with the new name!'
oh yikes, how did I not notice that?!
On Friday, 6 March 2020 at 13:55:25 UTC, Steven Schveighoffer
wrote:
On 3/6/20 6:51 AM, wjoe wrote:
On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
[...]
template opDispatch(string name) {
auto opDispatch(T,
On 3/6/20 9:42 AM, Steven Schveighoffer wrote:
alias opdispatch(T) = other_name!(name, T);
And obviously, this should be opDispatch with a capital D !
-Steve
On 3/6/20 9:14 AM, Adam D. Ruppe wrote:
On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer wrote:
Adam's way doesn't work either, because the call doesn't use the
alias, but just instantiates opDispatch with the new name!'
oh yikes, how did I not notice that?!
so yeah just kinda
On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer
wrote:
Adam's way doesn't work either, because the call doesn't use
the alias, but just instantiates opDispatch with the new name!'
oh yikes, how did I not notice that?!
so yeah just kinda screwed. I'd probably suggest at tis point
On 3/6/20 8:55 AM, Steven Schveighoffer wrote:
Instantiate!(f.opDispatch!fname, Bitmap)("path/to/wallpaper.png")
I realized, this doesn't work. Because f.opDispatch is a `this` call,
but is not called that way in this case.
Adam's way doesn't work either, because the call doesn't use the
On 3/6/20 6:51 AM, wjoe wrote:
On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
[...]
template opDispatch(string name) {
auto opDispatch(T, Args...)(Args args) {
...
}
}
[...]
NOTE: opDispatch suppresses
On Friday, 6 March 2020 at 11:51:54 UTC, wjoe wrote:
I don't understand this error message. Which type can't be
resolved?
I don't know. It works if you rename the inner one but it
doesn't like eponymous templates like this. I suspect either the
spec subtly doesn't allow it or a compiler
On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
[...]
template opDispatch(string name) {
auto opDispatch(T, Args...)(Args args) {
...
}
}
[...]
NOTE: opDispatch suppresses internal compile errors, it will
On Thursday, 5 March 2020 at 18:33:41 UTC, Adam D. Ruppe wrote:
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
Implement this for free functions i would do something like
this
void dispatch(alias fn, ARGS...)(Handle handle, ARGS args)
Why do you need an `alias fn` like that?
My
On Thursday, 5 March 2020 at 14:46:24 UTC, Steven Schveighoffer
wrote:
On 3/5/20 9:24 AM, wjoe wrote:
but how can I call fn in the context of an object instance?
You could do it with delegates. But it's ugly:
import std.stdio;
class C
{
void foo() { writeln("Yup");}
}
void main()
{
On Thursday, 5 March 2020 at 14:24:33 UTC, wjoe wrote:
Implement this for free functions i would do something like this
void dispatch(alias fn, ARGS...)(Handle handle, ARGS args)
Why do you need an `alias fn` like that?
My suggestion would be to just use the `opDispatch` magic method
that
On 3/5/20 9:24 AM, wjoe wrote:
but how can I call fn in the context of an object instance?
You could do it with delegates. But it's ugly:
import std.stdio;
class C
{
void foo() { writeln("Yup");}
}
void main()
{
alias f = C.foo;
auto c = new C;
void delegate() dg;
15 matches
Mail list logo