On 2015-08-28 22:40, rumbu wrote:
The linkage check it's good as long you don't have an abomination like
this:
extern(C++) interface CPPInterface
{
extern(D) void foo();
}
Good point.
Anyway, the problem is the availability of such function. If the
interface doesn't contain any
On 2015-08-26 20:59, Adam D. Ruppe wrote:
Yes, exactly. COM and C++ things won't necessarily have a D TypeInfo
available and since interfaces can be them, it can't be sure.
What I do there is to just cast the interface to Object. Then you should
check for null to cover those cases, then you
On Friday, 28 August 2015 at 06:19:55 UTC, Jacob Carlborg wrote:
On 2015-08-26 20:59, Adam D. Ruppe wrote:
Yes, exactly. COM and C++ things won't necessarily have a D
TypeInfo
available and since interfaces can be them, it can't be sure.
What I do there is to just cast the interface to
On Friday, 28 August 2015 at 06:19:55 UTC, Jacob Carlborg wrote:
Is it possible to detect at compile time if an interface is not
a native D interface?
Not fully, no, but you might be able to reflect into the methods
and see what kind of linkage they have.
On Friday, 28 August 2015 at 19:36:37 UTC, Jacob Carlborg wrote:
On 2015-08-28 17:41, rumbu wrote:
I don't know about Objective-C, but:
- for native D interfaces __traits(getVirtualIndex,
NativeInterface.firstFunction) == 1 since the first entry in
vtbl is the
contained object
- for C++
On 2015-08-28 16:31, Adam D. Ruppe wrote:
Not fully, no, but you might be able to reflect into the methods and see
what kind of linkage they have.
http://dlang.org/phobos/std_traits.html#functionLinkage
That might work.
However, you can't do anything with an interface that isn't in there
On 2015-08-28 17:41, rumbu wrote:
I don't know about Objective-C, but:
- for native D interfaces __traits(getVirtualIndex,
NativeInterface.firstFunction) == 1 since the first entry in vtbl is the
contained object
- for C++ interfaces __traits(getVirtualIndex,
CPPInterface.firstFunction) == 0
-
I noticed the calling classinfo on an interface returns the class info
of the static type and not the dynamic type. Is that intentional?
Perhaps because of COM and C++ interfaces?
module main;
import std.stdio;
interface Foo {}
class Bar : Foo {}
void main()
{
Foo f = new Bar;
On 08/26/2015 11:59 AM, Adam D. Ruppe wrote:
On Wednesday, 26 August 2015 at 18:53:19 UTC, Jacob Carlborg wrote:
Is that intentional? Perhaps because of COM and C++ interfaces?
Yes, exactly. COM and C++ things won't necessarily have a D TypeInfo
available and since interfaces can be them, it
On Wednesday, 26 August 2015 at 18:53:19 UTC, Jacob Carlborg
wrote:
Is that intentional? Perhaps because of COM and C++ interfaces?
Yes, exactly. COM and C++ things won't necessarily have a D
TypeInfo available and since interfaces can be them, it can't be
sure.
What I do there is to just
10 matches
Mail list logo