comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: Embeddinator-4000 begetting an Ada-cross-platform future?
Date: Fri, 16 Mar 2018 08:35:21 -0700 (PDT)
Date: 2018-03-16T08:35:21-07:00	[thread overview]
Message-ID: <77063005-bf79-4f34-ad91-35ce1f682c7e@googlegroups.com> (raw)
In-Reply-To: <93b2ceb2-0beb-47cf-a9f1-59ac7e81e052@googlegroups.com>

On Friday, March 16, 2018 at 4:55:56 AM UTC-5, alby....@gmail.com wrote:
> > Alex wrote:
> > > the resulting Api is a thin layer over the top of each of the winRT classes
> > > (each implemented as a tagged type) 

> On Thursday, March 15, 2018 at 2:24:51 AM UTC+11, Dan'l Miller wrote:
> > Oh, thank goodness!  Thank you very much!  Kenny Kerr's usage of value instances as type-ish
> > stand-ins for types will likely be the cause of criticism/ridicule of C++/WinRT once its usage
> > increases outside of Microsoft.

> Regarding your first point, I take it you mean that you are not a fan of the
> heavy use of C++ templates that Cpp/WinRt uses as an implementation. It does
> make the code hard to read/understand/maintain (in my opinion)

No, unfortunately, that is not what I am saying at all (although separately I have deep revulsion for Boost-esque metatemplate programming, sneaking functional-programming semantics in the backdoor via contortions of the C++ template engine).  What I am saying is much worse, as measured by eye-popping inane contortions of OO in ways that most strongly-typed-OO-knowlegdable people (in any language) would consider as inappropriate:  

https://github.com/Microsoft/cppwinrt/blob/master/Docs/Migrating%20C%2B%2B%20CX%20source%20code%20to%20C%2B%2B%20WinRT.md

<background>
Although the readers in this forum might not be the Nth degree of C++ experts, readers here are even less likely to recognize the /CX (divided by CX) and /CLI (divided by CLI) proprietary extensions to C++, as utilized (as C++/CX here, not C++/CLI) in the WWW-page above from Kenny Kerr et. al.  (Btw, /CX generates processor-native machine code; /CLI generates .NET CLR bytecode.)  In a nutshell, any time you see ^ as a suffix on a type, the ^ is playing much the same role as * (pointer) in standard C & C++, but grafting on an entirely different object model from ATL/COM Microsoft technologies.  ATL/COM's OO concepts vaguely resemble C++'s (or Ada's) processor-native OO object model, but are kept as entirely separate & disjoint as Objective-C runtime is from C++ in Apple's/Clang's/GCC's Objective-C++, but with still different semantics than either standard C++'s (or Ada's) processor-native object model or than Objective-C's runtime object model.  What those different semantics are is not germane here; suffice it to say, one must keep standard C++ instances, pointers, references, and collections (e.g., with * and & syntax) entirely away from /CX instance, references, and collections (i.e., clearly demarcated with ^-syntaxed WinRT-component references) and, except for some very limited forms of containment, one must keep standard C++ classes and structs almost entirely away from WinRT-component classes (i.e., as clearly demarcated by the “ref class” instead of “class” declaration.  Okay, now the reader has just enough background to read that URL's WWW-page.
</background>

Please take a look at the before & after transformation of source code in that WWW-page linked above to see how C++/CX code is to be transformed/rewritten as C++/WinRT source code.  Note that /CX (true-)types known to the compiler are transformed to value-semantics instances of (nontemplate) classes/structs so that the compiler no longer recognizes them as types at all!  As instances they remain a little bit strongly typed, but not things that are themselves (WinRT-component) instances of that pseudo-type record-instance (to use Ada's terminology) are obviously not instances of that pseudo-type to the compiler because the compiler knows types as types, not pseudo-types as types.  This contortion of data to represent types in ways that the compiler does not recognize as a type at all is what I am referring to.  The party-line claim is that this bizarre contortion is absolutely demanded by the problem-space as the only practical solution in C++2017.  Your VisualAda work will refute this (false) claim (because anything that you designed in Ada as true tagged types known as types to the Ada compiler has corresponding C++2003-era (or even C++2011 or C++2014 or C++2017) representations of a directly analogous design.  Thank you very very much!  Your work is not only a breakthrough for Ada, but for humankind in general spilling far beyond Ada, most notably in C++ by the corresponding implied C++ design analogous to your Ada tagged-type design.

> WRT using Ada tagged types as an implementation, that was an obvious choice,
> given that under GCC/GNAT C++ classes are equivalent to Ada Tagged types at the
> ABI level and the binding needs to support client overriding semantics (ie
> implementing a native/WinRT class and overriding a method/procedure)

I wholeheartedly agree.

> WRT generics, in my current alpha non-release :-) Due to an issue. I believe
> on my side, in getting dependent Ada packages (ie "limited with" and Ada generics
> to work nicely) I have resorted to doing inline expansion of the required
> code where needed.

Please keep up  the good work!  Also, please consider posting snippets of problematic limited-with & generics code in Ada to comp.lang.ada to see whether anyone can add further revelations.  Because you have a code-generator at the heart of VisualAda's WinRT/UWP bindings, generated non-generic Ada source code •might• be superior to generating generic-based code that needs its own compiler-based generic generation.  So you should consider the possibility that you might have the best-performing solution right now, either at run-time or build-time or both.

> When? I release sample code AND the underlying bindings/API you can analyse what
> I have implemented wrt mapping WinRT to Ada and I will take on the communities
> suggestion's on improvements. Note that I am far from being a "Language expert"
> in either C++ or Ada, But I know that instinctively Ada is my language of choice
> and I would like to see it as a general programming language (GPL) as it was
> originally intended.

I am sure that I & some others will look lovingly on anything that gets the job done.  I think you can declare this as a 0.1 release and that the 1.0 release's API/ABI/interface-façade/personality presented to app-domain code is likely to drastically change.


  reply	other threads:[~2018-03-16 15:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 17:06 Embeddinator-4000 begetting an Ada-cross-platform future? Dan'l Miller
2018-02-26 17:46 ` Dan'l Miller
2018-02-26 19:38   ` Mehdi Saada
2018-02-26 19:51     ` Dan'l Miller
2018-02-26 20:34 ` Luke A. Guest
2018-02-26 20:35   ` Luke A. Guest
2018-02-26 22:41     ` Dan'l Miller
2018-03-02 19:55     ` Ivan Levashev
2018-02-26 21:43   ` Dan'l Miller
2018-02-26 22:12     ` Luke A. Guest
2018-02-26 22:26       ` Dan'l Miller
2018-02-26 23:32         ` Randy Brukardt
2018-02-26 23:56           ` Dan'l Miller
2018-02-28 15:55             ` Dan'l Miller
2018-02-28 17:24               ` Lucretia
2018-02-28 19:20                 ` Dan'l Miller
2018-03-01 16:03                   ` Dan'l Miller
2018-03-01 18:04                   ` Shark8
2018-03-01 19:09                     ` Dan'l Miller
2018-03-01 22:25                       ` Shark8
2018-03-01 23:08                       ` Randy Brukardt
2018-03-02  5:39                         ` Bojan Bozovic
2018-02-26 22:30       ` Dan'l Miller
2018-02-26 22:36         ` Luke A. Guest
2018-03-01 20:36 ` Robert Eachus
2018-03-09 16:45   ` Dan'l Miller
2018-03-13  9:54     ` alby.gamper
2018-03-13 15:26       ` Dan'l Miller
2018-03-14  8:53         ` alby.gamper
2018-03-14 15:24           ` Dan'l Miller
2018-03-16  9:55             ` alby.gamper
2018-03-16 15:35               ` Dan'l Miller [this message]
2018-03-02 20:18 ` Ivan Levashev
2018-03-05 16:57   ` Dan'l Miller
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox