obj-c and webassembly report, tips on is expressions linked.

Posted 2019-04-15

obj-c and webassembly report, tips on is expressions linked.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

Tip of the Week

I wrote about the is() expression on the forum this week. If you have been perplexed by it before, take a look at this post and see if it makes any more sense. I actually kinda like it and find it easy to use... now that I have gotten to know it.

I also wrote about combining mixin and static foreach this week. See the post here to see how to write simpler mixins.

What Adam is working on

I have been meaning to play with the new dmd and new ldc releases for a while, and finally did this week, though only minimally. I took the Objective-C interop program from about a month ago, added the extern keyword as required by the new version, and compiled it. Everything worked! I'd say D with Objective-C interop is now usable, and we just need some bindings in druntime to make it convenient.

I also played briefly with ldc's webassembly generation feature, but it kept eliminating my functions, thinking they were unused. The magic flag to suppress this was -L--export-dynamic.

In fact, my crazy command ended up being: ldc2 -mtriple=wasm32-unknown-unknown-wasm -betterC -L--no-entry -L-allow-undefined test.d -fvisibility=hidden -L--export-dynamic I tried -disable-linker-strip-dead, but it had no effect, so I didn't keep it. -fvisibility=hidden means only functions in D marked export are kept - gives some more fine-grained control in there over what we want to show.

I am not really excited about webassembly myself. My view is if it can't actually call the web platform functions, what good is it? They say they are working on this though, with the hard part being an interaction with the JS garbage collector. There's ways to work with it anyway right now, but eh, i actually don't hate javascript enough to do this much effort. For now, at least.