OT: C# now has ref and const ref return

a11e99z black80 at bk.ru
Wed Aug 7 16:58:46 UTC 2019


On Wednesday, 7 August 2019 at 13:54:46 UTC, Ethan wrote:
> On Wednesday, 7 August 2019 at 12:36:53 UTC, Bert wrote:

> We have LDC. Someone sitting down and starting up D.NET and 
> integrating it in to the .NET Core ecosystem would be 
> fantastic. Then you could write D code in the .NET environment 
> and get access to the .NET runtime.

see https://en.wikipedia.org/wiki/Nemerle .NET with 
metaprogramming.
see .NET Native as CoreRT.
see compile scripts and expressions as lambdas - runtime 
metaprogramming with native speed.
but D.NET is no needed.

imo needed D++ (we have LDC)

// next is simple D module interop.d
//===================================================

codeC {
   #define SOME_MACRO /* */
   #include <stdio.h>
   struct A { .. }
   printf( "%d", a.fld );
}

// D code
// D structs support C/C++ inheritance with or without vtbl
// I mean diamond inheritance as C++ does
// D struct can be created at stack or C++ heap only (or member 
of D class)
struct D : A {
    void meth() {
      // can easy call any(?) C/C++ code without codeC(pp) blocks
      // or see as Terra interoperate with Lua
    }
}

codeCpp {
   #ifdef SOME_MACRO
   // classes in C++ is same C/C++ struct but only default private 
inheritance and members
   // allocated in stack or C++ heap cuz GC has undefined 
finalization order
   // for D code is same as struct { private: }
   class C : virtual public D {
   }
}

// D classes as now - allocated by GC or Scoped, cannot inherits 
structs
class ClassD {
   // usual D class
}

// just my comment in code:
// so f*ck alias this and add full C/C++ struct supports
// full C++ interop allow use D as system language as betterCpp
//===================================================


Clang has full C++ compiler that generates LLVM-IR.
LDC generates LLVM-IR too. they can live together.
Rust generates LLVM-IR too. need some universal TypeInfo that 
supports any kind of vtbl/types/descrs, something like Type 
Scheme for better world - u can program some module in lang that 
u think is more suitable.
C++ 2z will add dynamic compilation, LLVM supports it already.
D++ will have full C++ standard for ever.
No needed any wrappers to C/C++ for ever. U can use any of 
billion libs as is.

a lil problems:
- C++ uses std::string in most times. should D++ use it too?
   in any case D should use some nonGC-string (for betterC too)
   OT: imo any OSes and langs should use totally interoperable 
String class (something like improved BSTR) - many interop 
troubles will disappear.
- using C++ templates in D style.
- hmm.. probably no more problems.


More information about the Digitalmars-d mailing list