Cheng Wei , dans le message (digitalmars.D.learn:29865), a écrit :
> Thanks a lot. This solves the problem.
> 
> However, it breaks the abstractness. Now in D side, we can call
> auto v = ab(). This does not make sense, because then &v cannot be used
> in the C library.
> 
> I don't understand why when we manipulate AB*, D compiler needs to know
> the size of struct ab. Moreover, when we use AB*[int], the D compiler
> complains about there's no opHash defined for AB. I don't think they are
> necessary at all.

I guess D is not designed to use abstract classes because they are not 
needed in the language: the compiler reads all the symbols in the file 
before doing the real compilation, but there may be no real issue for 
the compiler, as long as you do not use the ab* for anything else than 
passing it to C code.
 
You could file an enhancement request to support abstract pointer for 
the sake of interoperability with C.

-- 
Christophe

Reply via email to