D for mobile development

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 8 03:29:29 PDT 2017


On Saturday, 8 July 2017 at 09:39:19 UTC, Ecstatic Coder wrote:
>>> Dan has been looking for someone to take over the iOS port, 
>>> which he hasn't had time for.
>>
>> So now, the only remaining android issue for DlangUI is an 
>> improved touch input...
>>
>> After that, mobile friendly custom widgets and theme.
>
> I've actually tried, and failed to make a "hello word" Android 
> app with D, and at the moment it's too "experimental". I mean, 
> complicated and incomplete.
>
> Even if it's possible in D, and the problem is just because I'm 
> not smart enough to succeed, at least that proves that with D 
> it's not easy enough.

I'm interested in what it is you tried, just D alone or DlangUI 
also for the GUI?  I have several simple OpenGL ES sample apps 
ported from the NDK, along with instructions on how to compile a 
couple of them, linked from that beta page.

> While Dart is already operational and user-friendly.
>
> If you don't believe me, simply look at the following Dart code 
> :
>
> import 'package:flutter/material.dart';
>
> void main()
> {
>     runApp( new MyApp() );
> }
> class MyApp extends StatelessWidget
> {
>     @override
>     Widget build( BuildContext context )
>     {
>         return new MaterialApp(
>             title : 'Flutter Demo',
>             theme : new ThemeData(
>                 primarySwatch : Colors.blue,
>                 ),
>             home : new MyHomePage( title : 'Flutter Demo Home 
> Page' ),
>             );
>     }
> }
> class MyHomePage extends StatefulWidget
> {
>     MyHomePage(
>         {
>             Key key, this.title
>         }
>         ) : super( key : key );
>     final String title;
>     @override
>     _MyHomePageState createState() => new _MyHomePageState();
> }
> class _MyHomePageState extends State<MyHomePage>
> {
>     int _counter = 0;
>     void _incrementCounter()
>     {
>         setState(
>             ()
>             {
>                 _counter++;
>             }
>             );
>     }
>     @override
>     Widget build( BuildContext context )
>     {
>         return new Scaffold(
>             appBar :
>                 new AppBar(
>                     title : new Text( widget.title ),
>                     ),
>             body :
>                 new Center(
>                     child : new Column(
>                         mainAxisAlignment : 
> MainAxisAlignment.center,
>                         children : <Widget>[
>                             new Text(
>                                 'You have pushed the button 
> this many times:',
>                                 ),
>                             new Text(
>                                 '${_counter}',
>                                 style : Theme.of( context 
> ).textTheme.display1,
>                                 ),
>                             ],
>                         ),
>                     ),
>             floatingActionButton :
>                 new FloatingActionButton(
>                     onPressed : _incrementCounter,
>                     tooltip : 'Increment',
>                     child : new Icon( Icons.add ),
>                     ),
>             );
>     }
> }
>
> This is the default code (with comments removed) which is 
> generated by the "flutter create" command.
>
> It's all that's needed to implement a nice-looking 
> material-design Android application where a dumb counter text 
> is incremented after the "+" circular button in the bottom is 
> pressed.
>
> Once the emulator has been started, executing the "flutter run" 
> command in the app folder is all that is required to compile, 
> upload, and start the application in the Android emulator.
>
> And if I change anything in the code, I just have to press "r" 
> at the command line prompt.
>
> In less than a second, the application is hot-reloaded in the 
> Android emulator.
>
> So it's all about usability, as always.
>
> The Dart language is barely OK compared to D, but the default 
> libraries and its ecosystem are very user-friendly.

Yes, D is nowhere near that easy to use on Android.

> And I know that's because a lot of Google engineers are 
> currently paid full-time to implement and polish them.

I was surprised to see recently that one of the main D 
contributors, who's been blogging about how he wants to improve 
the GC recently, has apparently been working at google on Dart 
for the last year.  So even our own community is contributing to 
Dart for their day job... the consequences of having money and 
companies behind the language.

> IMHO, the curent D language and standard libraries are fine 
> enough, and instead of investing time in tweaking them, making 
> this GUI library and the required tool chain fully operational 
> on desktop and mobile platform should be the #1 priority.

This is a community-driven OSS project, there is no #1 priority.  
You may want that, but many others may not care for it, and you 
can't make them volunteer to do it.

> Because as long as developing cross-platform connected mobile 
> apps and backends is significantly EASIER with other languages 
> (and I'm not only talking about Dart), it will be very hard for 
> D to somewhat improve its popularity.

D compares more to the C/C++ NDK, which isn't in the same league 
of ease of use and integration as you talk about with Dart. But D 
could also be used for more lightweight GUI app development, so 
we'd like to get it to the usability level of Dart someday.

> And this is actually the #1 reason why I can't convince ANY of 
> the developers I know to even try the language...

Are you talking about the ease of GUI development or mobile or 
both holding D back?  I agree that D has neglected mobile, see my 
recent thread:

http://forum.dlang.org/thread/xgiwhblmkvcgnsktjnoo@forum.dlang.org


More information about the Digitalmars-d mailing list