D for mobile development

Ecstatic Coder via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 8 02:39:19 PDT 2017


>> 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.

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.

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

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.

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.

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




More information about the Digitalmars-d mailing list