Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread Gavin Ray via Digitalmars-d-learn
On Monday, 24 May 2021 at 20:31:18 UTC, sighoya wrote: On Monday, 24 May 2021 at 17:39:38 UTC, Gavin Ray wrote: Hence why I was asking how to make D structs/classes that have compatible or identical vtables to multiply inherited objects to pass as arguments to `extern (C++)` functions. I

Re: coreutils with D trials, wc, binary vs well formed utf

2021-05-24 Thread btiffin via Digitalmars-d-learn
Thanks for these hints. I'm new here, but not so much to programming. Been following D since, well 2007 or 8. Awaiting the GCCing to gel. Nice. Still a little rough on Ubuntu 18.04, dub package seems to want ldc and dmd from dlang borks with a segfault in start (which is probably a my

Re: coreutils with D trials, wc, binary vs well formed utf

2021-05-24 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 24 May 2021 at 16:58:33 UTC, btiffin wrote: [...] Just bumped into https://dlang.org/blog/2020/01/28/wc-in-d-712-characters-without-a-single-branch/ [...] Is there a(n easy-ish) way to fix up that wc.d source in the blog to fallback to byte stream mode when a utf-8 reader fails

Re: coreutils with D trials, wc, binary vs well formed utf

2021-05-24 Thread Dukc via Digitalmars-d-learn
Is there a(n easy-ish) way to fix up that wc.d source in the blog to fallback to byte stream mode when a utf-8 reader fails an encoding? Rewrite `toLine`: ``` Line toLine(char[] l) pure { import std.array : array; import std.algorithm : filter; import std.utf : byDchar, replacementDchar;

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread sighoya via Digitalmars-d-learn
On Monday, 24 May 2021 at 17:39:38 UTC, Gavin Ray wrote: I'd be grateful for solid information on this Here is a more informal report how it works in C++: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.23.4735=rep1=pdf But in the end, I think a byte code analysis is needed to be

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread sighoya via Digitalmars-d-learn
On Monday, 24 May 2021 at 17:39:38 UTC, Gavin Ray wrote: Hence why I was asking how to make D structs/classes that have compatible or identical vtables to multiply inherited objects to pass as arguments to `extern (C++)` functions. I think classes annotated with extern is your only high level

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Monday, 24 May 2021 at 18:52:22 UTC, Ola Fosheim Grostad wrote: If an informal description is needed then the best option is to search the Clang mailing list. Btw clang docs say they strive to match msvsc, so apparently it is platform dependent. The only sensible option is to check with

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread Ola Fosheim Grostad via Digitalmars-d-learn
On Monday, 24 May 2021 at 18:46:00 UTC, Guillaume Piolat wrote: Multiple inheritance is a rare topic here, I doubt too many people know how it works internally. It is described in the link I gave, or? If I tried to give an informal description I would probably be inaccurate and that would be

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread Guillaume Piolat via Digitalmars-d-learn
On Monday, 24 May 2021 at 17:39:38 UTC, Gavin Ray wrote: On Sunday, 23 May 2021 at 21:08:06 UTC, Ola Fosheim Grostad wrote: On Sunday, 23 May 2021 at 21:02:31 UTC, Gavin Ray wrote: I don't really know anything at all about compilers or low-level code -- but is there any high-level notion of

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread Gavin Ray via Digitalmars-d-learn
On Sunday, 23 May 2021 at 21:08:06 UTC, Ola Fosheim Grostad wrote: On Sunday, 23 May 2021 at 21:02:31 UTC, Gavin Ray wrote: I don't really know anything at all about compilers or low-level code -- but is there any high-level notion of "inheritance" after it's been compiled? Yes, in the

coreutils with D trials, wc, binary vs well formed utf

2021-05-24 Thread btiffin via Digitalmars-d-learn
Hello, New here. A little background. Old guy, program for both work and recreation, GNU maintainer for the GnuCOBOL package; written in C, compiles COBOL via C intermediates. Fell into the role of maintainer mainly due to being a documentation writer and early on cheerleader. Experienced

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-24 Thread Alain De Vos via Digitalmars-d-learn
Multiple inheritance is hard. If you know how it works, just add it to the dmd,ldc compilers. If no, try to walk around it :) With interfaces you can mimic a bit, but don't get Bjarne Stroustrup level.