>
>
> At the moment, the ref-ness of the return type is not determined
> correctly because of a compiler bug. Otherwise, that works mostly
> fine.
>
>
Thank you Max for showing me toDelegate. But I find that it does not work
even for function arguments with default values. So for the moment I will
On Friday, 1 June 2012 at 14:33:59 UTC, d coder wrote:
Steve
One small thing. As you said I might declare a delegate in an
alternate
fashion that is by saying "void delegate() dg;".
But would it be possible to rewrite the following declaration
in a way that
avoids naming foo explicitly. I wo
On Saturday, 2 June 2012 at 17:33:04 UTC, Max Samukha wrote:
(of function pointer) type, so you will have to go hacky. It is
easiest to use std.functional.toDelegate (don't ask why it is in
std.functional):
s/of function pointer/or function pointer/
On Fri, 01 Jun 2012 10:57:34 -0400, Jacob Carlborg wrote:
I don't see this example as strange. I mean, the same would work with a
pointer or ref.
An alias is not a pointer or ref, and it's not passed in at runtime, it's
passed in at compile time.
-Steve
On 2012-06-01 16:30, Steven Schveighoffer wrote:
I'm surprised at some things that work with alias. It sometimes seems
like black magic.
Consider that this does work:
void incx(alias x)()
{
x++;
}
void main()
{
int x = 0;
incx!x();
assert(x == 1);
}
now, consider that when incx!x is compile
On Fri, 01 Jun 2012 10:33:07 -0400, d coder wrote:
Steve
One small thing. As you said I might declare a delegate in an alternate
fashion that is by saying "void delegate() dg;".
But would it be possible to rewrite the following declaration in a way
that
avoids naming foo explicitly. I woul
Steve
One small thing. As you said I might declare a delegate in an alternate
fashion that is by saying "void delegate() dg;".
But would it be possible to rewrite the following declaration in a way that
avoids naming foo explicitly. I would just have an alias for foo. I am
asking this to cover th
On Fri, 01 Jun 2012 10:14:26 -0400, Jacob Carlborg wrote:
On 2012-06-01 15:51, Steven Schveighoffer wrote:
On Fri, 01 Jun 2012 09:25:57 -0400, d coder
wrote:
Class Bar(alias F) {
// Call F in some function here
}
Class Foo {
void foo();
Bar!(() {foo();}) bar;
}
Again this does not work. M
On Fri, 01 Jun 2012 10:09:49 -0400, d coder wrote:
Hello Steve
There is a way, as I hinted :)
I'll show you how, but be prepared to deal with ugliness!
All this smart code would be hidden from the end-users so I really do not
care.
typeof(&F.init.foo) dg; // alternately: void delegate
On 2012-06-01 15:51, Steven Schveighoffer wrote:
On Fri, 01 Jun 2012 09:25:57 -0400, d coder wrote:
Class Bar(alias F) {
// Call F in some function here
}
Class Foo {
void foo();
Bar!(() {foo();}) bar;
}
Again this does not work. Maybe I am expecting too much from D. :-) I am
somewhat aware o
On Fri, Jun 1, 2012 at 7:40 PM, Mehrdad wrote:
> Another way to phrase it would be that D is forcing you to to use
> templates where they really aren't meant to be used. :\
>
>
No. I am working on a Domain Specific Language and want to cut on the code
the end user has to write. If I were working
Another way to phrase it would be that D is forcing you to to use
templates where they really aren't meant to be used. :\
Hello Steve
> There is a way, as I hinted :)
>
> I'll show you how, but be prepared to deal with ugliness!
>
All this smart code would be hidden from the end-users so I really do not
care.
> typeof(&F.init.foo) dg; // alternately: void delegate() dg;
> dg.funcptr = &F.foo;// use the type,
On Fri, 01 Jun 2012 09:25:57 -0400, d coder wrote:
Hello Steve, thanks for looking at this.
I see the code works when I create the delegate first and then send it to
template. That is the way you do it here.
void main() {
Foo f = new Foo();
auto dg = &f.foo; // need to make a symbol so i
On 2012-06-01 15:25, d coder wrote:
Hello Steve, thanks for looking at this.
I see the code works when I create the delegate first and then send it
to template. That is the way you do it here.
void main() {
Foo f = new Foo();
auto dg = &f.foo; // need to make a symbol so it can
Hello Steve, thanks for looking at this.
I see the code works when I create the delegate first and then send it to
template. That is the way you do it here.
> void main() {
> Foo f = new Foo();
> auto dg = &f.foo; // need to make a symbol so it can be aliased
> callfoo!(dg)();
> }
>
>
But it
On Fri, 01 Jun 2012 08:32:02 -0400, d coder wrote:
Hello All
Particularly I would like to know if it is possible at all in D to
invoke a
class method transferred to a scope outside the class as an alias
argument.
Is it possible? Yes. But not easy. I won't go into the details, but
su
On Friday, 1 June 2012 at 12:32:55 UTC, d coder wrote:
Hello All
Particularly I would like to know if it is possible at all in D
to invoke a
class method transferred to a scope outside the class as an
alias argument.
Regards
- Puneet
I think it should work, if I understand correctly what y
Hello All
Particularly I would like to know if it is possible at all in D to invoke a
class method transferred to a scope outside the class as an alias argument.
Regards
- Puneet
Greetings
Kindly make me understand this. I have been trying to call an alias for a
class method from another scope. I keep getting an error saying that I need
"this" to call a method. Why will not "this" pointer be available when I am
passing the method symbol along with an object of the class? I
20 matches
Mail list logo