After having used C++ and Faust for a while to write Synth plugins I decided to try out some alternatives. My main requirements for the language were automatic memory management, easy to use bidirectional C interfacing for using and exposing C libraries and support for functional programming. I considered amongst others OCaml, Haskell, D and Vala as language options. After a small evaluation of the options I decided to focus on D. OCaml didn’t look like a proper evolution over Standard ML, Haskell too demanding to learn and Vala with too many Gnome dependencies.
D is a statically typed C-based language with the ambitious goal to provide a better C++. It feels more consistent than C++, but sits oddly between a system and application level language. As a small exercise I ported the STK library to D to get a better feel of the language features. I named the port synd.
What I liked were the module system, properties, type inference and integrated support for unit tests. What I found confusing were mutability of ranges, initialization of members and the quite heterogeneous community. Missing support for shared library creation in Linux is a showstopper for now.
I am still trying to figure out whether to use closures for lower level elements or Class based objects. The FP approach allows for more consistent types and composition of elements whereas the OOP approach offers better separation between configuration and other method calls.
Cascaded delegate construction would also work in D. And it works quite well for elements where only static and sample based configuration parameters are used. For configuration updates let’s say every 32 samples something else would need to be used.