Is there a way to create compile-time delegates?
Simen kjaeraas
simen.kjaras at gmail.com
Wed Jul 21 12:49:21 PDT 2010
Sean Kelly <sean at invisibleduck.org> wrote:
> Don Wrote:
>
>> Philippe Sigaud wrote:
>> > On Mon, Jul 19, 2010 at 22:01, torhu <no at spam.invalid> wrote:
>> >
>> >
>> >
>> > I wasn't able to make it work.
>> >
>> >
>> > Me too :(
>> >
>> >
>> > The compiler probably sees delegates as something that just can't
>> be
>> > created at compile time, since no runtime contexts exist then.
>> > Which is reasonable.
>> >
>> >
>> > Can you initialize pointers in general, at compile-time?
>>
>> You cannot initialize a pointer to runtime-allocated data at
>> compile-time, and will never be able to. This particular example cannot
>> ever work.
>
> You can get pretty close by using structs with opCall defined though.
Not if the function I got only takes delegates, and needs to only take
delegates.
--
Simen
More information about the Digitalmars-d-learn
mailing list