dmd beta, more info coming next time, demo of new web framework initial prototype
Posted 2019-02-18
Blog
Articles- terminal.d gets clipboard functions, ldc 1.20 out.
- DConf keynote speaker announced: Lua architect Roberto Ierusalimschy, Named args DIP discussed
- February 3, 2020
- Adam's terminal suite explained
- Understanding mixin templates, terminal.d improvements
- My attribute-by-default proposal. Also dmd 2.090 came out.
- DConf 2020 announced: June 17-20 in London. @safe by default debated. Adam did: Android, JNI, WebSocket in arsd libs
- tar.xz, --DRT tip, dom bug fixes, more Android and JNI, link to old phobos docs
- LDC 1.19 - Android, AVR. My rant on tests, update on JNI and COM.
- Walter's string interpolation proposal is OK but not great. My Android thing nearing beta release. dub downtime explained.
- Android project update, introduction to arsd.jni
- New pattern about interface contracts
- Adam shares Windows console secrets - DO NOT USE chcp!!
- Adam's rant on benchmarks
- Socket tutorial
- November 4, 2019
- October 28, 2019
- arsd package updates, forum nonsense
- Update on Android
- Adam does iOS "goodbye world"
- September 30, 2019
- D turns 20, Adam rants on software freedom
- Named arg DIPs and my thoughts on code organization
- September 9, 2019
- I wrote about mixin templates vs string mixins on Stack Overflow
- August 26, 2019
- Bug bounty in D again - my hot take, on reusing code, a fun picture, my tentative plan for the next month
- Time invested is worth a lot
- cgi.d's new scheduler, static this tricks
- July 29, 2019
- July 22, 2019
- Solving vs managing problems
- A big week in the arsd repo
- July 1, 2019
- June 24, 2019
- June 17, 2019
- CRTP thoughts, named arguments DIP review, DConf videos now on youtube
- musings on hybrid CT/RT tests, some more progress on new web framework
- a little more webassembly
- May 20, 2019
- Adam's string interpolation proposal
- DMD 2.086 live, GCC 9 with D support formally released, DConf coming soon, links to posts on builder pattern and disallowing implicit conversions with templates, and 2d array op overloads
- template constraint error improvements coming?
- dmd 2.086 beta, dstep 1.0 released, Adam works on memory usage
- obj-c and webassembly report, tips on is expressions linked.
- new ldc, new dmd, dpp on the blog
- D's future discussed in forums
- LDC beta, DConf blog link, Adam introduces gamehelpers.d
- March 18, 2019
- LDC 1.15.0-beta1, responsive design rant
- dmd 2.085.0 released
- Obj-C interop and D without druntime code to copy/paste
- dmd beta, more info coming next time, demo of new web framework initial prototype
- automatic web interface discussion, reflection tips and tricks
- Adam busy with weather and a move, lots of community announcements
- January 28, 2019
- Working on official blog 2018 retro, C++ new wrapped, dmd reading zips?
- dmd obj-c growing, Adam static foreaches an interface to RPC
- dmd 2.084, hope for future, but busy non-D week for me
- IDE tools released, my cgi.d gets new features
- DConf announced, tip, Adam rants: mouse trap
- This Week in D is back!
The new dmd beta came out this week, with lots of objective-C stuff, but I haven't had a chance to try it yet. Meanwhile, we got another LDC release, and in my world, I made some more progress on my new D web framework.
Core D Development Statistics
In the community
Community announcements
See more at the announce forum.
What Adam is working on
I continue to make progress on the REST code, but I'm still not happy with it yet - I usually don't write about my libraries... well, barely at all, but especially not as I go, so I keep optimistically saying "next week", but I should stop promising that. My wrist gets frequently sore, so even when I have time, I can't always be hacking on code :(
In any case, last week, I wrote about the RPC-style generator, where it wraps method classes with web interfaces, and this week, I got the REST-style generator basically working.
The way it works is you write a pretty basic data class, dispatch to it, and let the library do the rest (pun ALWAYS intended ;P). Behold:
Well, the comments in there speak for the code. You can play with the result of this code live here (assuming it is still live when you read this).
As you go through the generated site, you'll see many imperfections - the code isn't quite done yet. But it basically works and the sample code gives you an idea of where I'm going, though the API is also still likely to change a little as I actually use it.
Speaking of APIs, we can use this same code for JSON work. Just throw ?format=json on the url. for example.
You can also use your HTTP verbs, like with curl:
Notice the 201 response and the location in the header of the new object. Now, I want to edit it:
And you can see the result there is more-or-less what you probably expected, though the code has no special handling for any of this!
Feel free to play with my demo a bit, just be aware I am probably going to wipe the database randomly and might take the demo down later, so don't be alarmed if it doesn't work.
Well, I am going to end here without much more talk, since I need to get off the computer again... blargh. But, next time I get some time, I will write more about the implementation. Much of it is simple enough - just some convention over configuration, basically - but some of the reflection code is still worth talking about, and, of course, the justification of various "RESTful" decisions (the RestObject is not a DataObject per se; it is meant to define api rather than data storage, but I don't wanna go into detail of that... yet) and MVC architecture - or lack thereof - will be interesting. Controversy alert! lol
(And, of course, I still need to finish the Presenter class, which will let you fully customize the generated html!)
BTW: the demo is running in cgi mode, but as always, cgi.d can host in many modes, including the embedded http server... which got another little performance improvement this week. It can run 44k reqs/sec on my computer; not too awful.
PS D rox. The modeling power with the static information is really fun to play with.