www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D for mobile development

reply Ecstatic Coder <ecstatic.coder gmail.com> writes:
In a few days I will try to develop a small mobile application 
for iOS and Android.

At first I wanted to implement it in D, but I quickly came to the 
conclusion that this actually wasn't an option.

Now I'm in the process of trying both Dart and Haxe.

Both allow to implement the server and the mobile application.

https://www.slant.co/versus/383/1543/~dart_vs_kotlin

"The most important reason people chose Dart is: Dart includes a 
truly comprehensive core library, making it unnecessary to 
include disparate, external resources for basic functionalities 
Other than reducing the need to pull in various 3rd-party 
utilities this also ensures that all Dart code looks and feels 
the same."

https://www.slant.co/versus/383/381/~dart_vs_haxe

"The most important reason people chose Haxe is: Haxe allows you 
to develop for Web, iOS, Android, Blackberry, Windows, OSX, Linux 
and others, all at once, without the need to switch languages and 
maintain separate code bases. This is possible because Haxe can 
compile to JavaScript, ActionScript, Flash AVM bytecode, C++, 
Neko, PHP, C# (.NET) and Java. Support for even more platforms 
and languages is under development."

That makes me sad and angry, because after a few experiments I 
can already say the both languages are WAY behind D, and feel 
very limited and primitive compared to D.

But they indeed get the job done for web server and connected 
mobile application development.

Another proof that money and corporate support is what D is 
severely lacking of...
Jul 07
parent reply =?UTF-8?Q?S=c3=b6nke_Ludwig?= <sludwig+d outerproduct.org> writes:
My impression was that Android is more or less solved these days:

https://github.com/joakim-noah/android/releases

iOS development seems like it has stalled since the start of this year, 
which is quite sad. Maybe someone knows the status of this?

https://github.com/smolt/ldc/commits/a0201e4c1711e38ce62a5008e51f246c8d301b0c
Jul 07
parent reply Joakim <dlang joakim.fea.st> writes:
On Friday, 7 July 2017 at 10:00:10 UTC, Sönke Ludwig wrote:
 My impression was that Android is more or less solved these 
 days:

 https://github.com/joakim-noah/android/releases
Yes, try it out. We're currently looking at merging the last change so Android cross-compilation support ships with the official ldc releases. You have to use the linked betas for now. Another issue is that there's no touch GUI written in D that I know of (DlangUI has been built for Android, but I think it's meant for mouse input: http://forum.dlang.org/thread/cdekkumjynhqoxvmgjze forum.dlang.org), though you could go the more traditional route of writing the GUI in Java and the core logic in D, interfacing the two through JNI.
 iOS development seems like it has stalled since the start of 
 this year, which is quite sad. Maybe someone knows the status 
 of this?

 https://github.com/smolt/ldc/commits/a0201e4c1711e38ce62a5008e51f246c8d301b0c
Dan has been looking for someone to take over the iOS port, which he hasn't had time for.
Jul 07
parent reply aberba <karabutaworld gmail.com> writes:
On Friday, 7 July 2017 at 10:28:06 UTC, Joakim wrote:
 On Friday, 7 July 2017 at 10:00:10 UTC, Sönke Ludwig wrote:
 [...]
Yes, try it out. We're currently looking at merging the last change so Android cross-compilation support ships with the official ldc releases. You have to use the linked betas for now. Another issue is that there's no touch GUI written in D that I know of (DlangUI has been built for Android, but I think it's meant for mouse input: http://forum.dlang.org/thread/cdekkumjynhqoxvmgjze forum.dlang.org), though you could go the more traditional route of writing the GUI in Java and the core logic in D, interfacing the two through JNI.
 [...]
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.
Jul 07
parent reply Ecstatic Coder <ecstatic.coder gmail.com> writes:
 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...
Jul 08
parent reply Joakim <dlang joakim.fea.st> writes:
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
Jul 08
parent Ecstatic Coder <ecstatic.coder gmail.com> writes:
 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.
Indeed. But that doesn't mean that I'm completely wrong in thinking that a language which is natively very convenient for web and mobile development (like Dart) can easily increase its popularity.
 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.
That's right, but I still think that D, as a language, has everything needed to make it the perfect language for mobile, server and desktop applications. D is as convenient as a high-level scripting language, and in the mean time as fast and powerful as a low-level programming language like C++. That's the ideal mix for mobile applications. And nowadays MANY programmers are developing connected and mobile applications.
 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
+1
Jul 08