OSCON 2012 notes

Michel Fortin michel.fortin at michelf.ca
Sun Jul 22 14:58:20 PDT 2012


On 2012-07-22 19:05:45 +0000, Nick Sabalausky 
<SeeWebsiteToContactMe at semitwist.com> said:

> On Sun, 22 Jul 2012 08:19:12 -0400
> Michel Fortin <michel.fortin at michelf.ca> wrote:
> 
>> On 2012-07-21 19:51:37 +0000, Nick Sabalausky
>> <SeeWebsiteToContactMe at semitwist.com> said:
>> 
>>> On Sat, 21 Jul 2012 09:47:06 -0400
>>> Michel Fortin <michel.fortin at michelf.ca> wrote:
>>>> 
>>>> And also, more and more it'd require ARM support to be competitive
>>>> in the GUI area.
>>> 
>>> Yes. But there's an even bigger reason for ARM: Mobile devices, like
>>> iOS and Android. I'm not personally a fan of them, but nonetheless
>>> those things are HUGE (no pun intended). And yet the ONLY real
>>> language choices there are C++, Java and Objective-C (and Lua if
>>> you count "Son-of-Flash", ie Corona - which I don't count). And
>>> half of THOSE are out of the question if you want cross platform,
>>> which any sane developer should. So PERFECT fertile ground for D.
>>> 
>>> I know I keep harping on that, but it's a big issue for me since I'm
>>> deep into that stuff now and goddamn do I wish I could be doing
>>> it in D, but D's support on those devices (or just outputting C/C++)
>>> unfortunately just isn't mature enough ATM.
>> 
>> For my part, in the last year I've been building a big codebase that
>> had to be C++ just because of this, with countless hours spent
>> figuring out things that would have been a lot easier to do in D.
>> 
>> Here's the problem as I came to realize it: no single project is
>> going to be enough to justify the investment required to make it
>> happen. Nobody's project is by itself big enough to make
>> D/Objective-C worthwhile to produce and maintain, because making it
>> and then keeping it in sync with both D and Apple's Objective-C is a
>> huge effort that'll in itself derail the project you were using to
>> justify the investment. So D/Objective-C has to stand as a project of
>> its own somehow.
>> 
>> Also, making it a cross-platform thing would require a similar
>> investment for WinRT and Android (through JNI?). While it surely is
>> technically possible and would sure help a lot of developers move
>> away from C++, I'm not so sure such a thing will happen at all.
>> 
> 
> FWIW, Marmalade ( www.madewithmarmalade.com ) has already done the
> legwork to allow crossplatform natively-compiled C++ code that works on
> iOS, Android and a bunch of other less "hip" stuff like Bada, WebOS,
> Symbian, and some version of mobile windows (6, IIRC). I'm sure
> they'll be doing WinRT at some point if not already working on it. They
> do abstract away the underlying OS calls (including usage of
> Objective-C), although they also provide a (somewhat roundabout) way to
> access them directly if you need. Unfortunately, it's not open-source
> and it's somewhat pricey, but point is, C++ across all those platforms
> does at least exist.

Marmalade, from what I see, is some sort of meta-platform you can use 
to write something that works everywhere. It adds a new layer of 
abstraction that can work on top of each platform. Good for them and 
their developers, but I generally try to avoid unnecessary layers like 
this. It often makes things harder to debug and fix, and will always 
lag behind the functionalities each of platform has to offer.

No, the idea is to make the D *language* work with each platform's 
object model. Just like D can call and define C functions with zero 
overhead, it should be capable of defining classes from other languages 
too and overriding their functions with zero overhead. That way you can 
talk directly with each platform's API with no middle man playing a 
complicated translation/abstraction process in the middle.


> Also, on the Android, you don't need to deal with the JVM (or whatever
> Google's version of it is called). Apparently that used to
> be the case, but now you can just use straight C++, even without third
> party tools like Marmalade.

But all the interface widgets are still in Java, no? If you're working 
on an OpenGL/ES game maybe you won,t need them, but if you're building 
any other kind of app, you'll have to play with JNI a lot. Or add 
Marmalade as an abstraction layer. Either way it's suboptimal compared 
to using directly the APIs you need.


> There's a lot of about Google and Android I
> don't like, but as usual: At least it's not *quite* as shitty as dealing
> with Apple's inevitably putrid offering.

With Apple's platform, integrating a C++ backend with an Objective-C 
frontend is quite a breeze: both object models mix very well together. 
It's pretty much the same thing as Microsoft did with WinRT: regular 
C++ classes mix with WinRT classes in the same source file pretty much 
in the same way. Try do that with Android's UI classes written in Java. 
But maybe I misunderstood what you're referring to.


-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list