My Android project nearing beta

Adam D. Ruppe destructionator at gmail.com
Fri Jan 10 15:05:21 UTC 2020


On Wednesday, 8 January 2020 at 14:23:49 UTC, Chris wrote:
> Btw, how will D for Android handle multi-threading / coroutines?

So again I haven't actually tested, but based on the 
implementation right now you can have D threads and Java threads, 
but they shouldn't mix. I think I can fix that later by offering 
attach/detach D to Java threads, and possibly do it automatically 
with static ctors.

But I'm just not there yet.


BTW I did finally call the code generator good enough yesterday. 
I was trying to mimic the Java inheritance tree in D but that hit 
various troubles (including two separate dmd bugs!), so instead, 
the code generator flattens everything into individual D final 
classes.

Then if you need to cast to a Java interface, you'll have to use 
a template function instead. Best compromise of usability I could 
get right now.

The Android TextView widget takes 30 seconds to compile since it 
pulls in virtually everything :( I also changed it so return 
values are automatically imported to avoid linker errors but that 
is a good chunk as to why it gets so slow.

I experimented with opaque return values you must instantiate but 
you'd then have to explicitly call it an every return, and the 
builder pattern was annoying:

Foo.builder.get.whatever.get.whatever.get

each of those .get things are the instantiate thing. Trying 
opDispatch and alias this both failed due to awful error messages 
leading to bad usability or dmd segfaults. So... idk I might go 
back to that idea since writing .get isn't too bad. But it is a 
matter of trading compile time for more natural looking code and 
idk what I like most yet.


More information about the Digitalmars-d-announce mailing list