On Tuesday, 5 March 2013 at 16:02:50 UTC, Steven Schveighoffer wrote:
On Mon, 04 Mar 2013 21:58:57 -0500, eGust <[email protected]> wrote:

On Tuesday, 5 March 2013 at 02:15:33 UTC, anonymous wrote:
On Tuesday, 5 March 2013 at 02:01:47 UTC, eGust wrote:
Can I write something like this:

__gshared immutable foo = {
auto
        func1   = &fn1,
        func2   = &fn2,
...
}

Or just

... = {
&fn1, &fn2, ...
}

import std.typecons: tuple;
__gshared immutable foo = tuple(&fn1, &fn2, ...);

Yes, it looks better. Can tuple guarantee the order and alignment of the elements? I need an interface with other languages.

It will be equivalent to a struct declared with those members.

However, I would say if you are looking for a type to push across languages, why not declare the type?

-Steve
Thank you all guys. I'll use tuple. This way will make it faster and easier.

If QtD can be built with 2.062, I would do all my work in D. Now I'm using CPP which is I'd never used before. It already bothers me. Now I'm writing C-style CPP for GUI and D for all the others in the same time, so I must try to reduce the number of the interface functions. That's why I don't wanna waste my time on repeating the same declarations, especially it's a trouble if I make any change. Because it's easy to output the type of var in D, I think I can make them declared in the end. :)

Reply via email to