Page 1 of 1

Builing modules with other, non-Java JVM languages

Posted: Tue Jun 02, 2020 10:24 pm
by nekomatic
Has anybody actually tried building a module for VM using a language different than Java? Or at least tried to add an external library (like i.e. stdlib of the language). I'm interested to see if you had any situation when an extra jar added to the VMD upsets the Voltage Modular in any way... I.e. I tried building some stuff in Kotlin - everything works fine in VMD but it seems VM does not like if there are too many classes used in the module (i.e. kotlin's stdlib ).

A concrete example - I have initally built the Almanacs Granular Processor entirely in Kotlin and it was tested in this form also in terms of performance which was very good even on my very old PC - One annoing VM issue we encoumtered was when we tried to add this module to an empty cabinet right after the VM started, VM UI got frozen for couple of seconds, from my observations it did seem like VM cannot efficiently handle modules whith larger number of classes - in comparison the startup time of the same code outside VM had to be measured in milliseconds - I have rewritten this module in pure java from scratch so its not affected anymore but it seems using any off-the-shelf library will most likely cause such UI freeze.

I have obvioulsy notified support about this but they seem rather busy these days fine-tuning all the other performance issues so in the meantime I took the chance to find out if anybody else on this forum had similar experience - or maybe it's just me?

Re: Builing modules with other, non-Java JVM languages

Posted: Mon Jun 13, 2022 4:45 am
by ichiohta
I'm writing modules in Kotlin. The UI surface is still have to be written in Java but I could write most of the DSP code in Kotlin.
Have to include Kotlin runtime in a module binary, and it makes the module size bigger, but it works. I wish if Voltage Modular runtime include Kotlin runtime too.

Re: Builing modules with other, non-Java JVM languages

Posted: Mon Jun 13, 2022 5:43 pm
by UrbanCyborg
Just out of curiosity, have you tried including only the required elements of the standard library (assuming that's possible; I'm not familiar with that language).

Re: Builing modules with other, non-Java JVM languages

Posted: Mon Jun 13, 2022 7:16 pm
by boingy
ichiohta wrote: Mon Jun 13, 2022 4:45 am I'm writing modules in Kotlin. The UI surface is still have to be written in Java but I could write most of the DSP code in Kotlin.
Have to include Kotlin runtime in a module binary, and it makes the module size bigger, but it works. I wish if Voltage Modular runtime include Kotlin runtime too.
Can I ask why you use Kotlin? It's not one I've heard of before. What are the advantages for VM stuff?

Re: Builing modules with other, non-Java JVM languages

Posted: Mon Jun 13, 2022 8:02 pm
by ColinP
I only discovered Kotlin recently. It has some nice modern features but doesn't seem to offer anything that would make me want to switch to it from Java. It's supposed to be an easy transition from Java but the syntax is quite different so I don't think that claim stands up.

Even though Java and Kotlin will happily coexist I wouldn't want to do the mental gymnastics involved in moving between the two in a project that involved both.

Also I like very strict typing (or at the opposite extreme duck typing) so am unsure about type inference. Also at least superficially some Kotlin features look like solutions looking for problems. This reminds me of when Eiffel went from V2 to V3 in order to solve problems that 99.9% of the time you wouldn't encounter. Simplicity is underrated in language design.

When I was younger I used to switch languages about once a year and designed and implemented many languages myself but I'm in my sixties now and am happy enough to stick with Java. It's an idiom I can work in at high speed because I don't need to think too much (although I am still learning all the time). But essentially it's a bit like mountain biking - if you think about what you're doing you'll crash.

I've also come to realise that programming is really not the hardest part of developing. Designing new stuff is the real challenge.

Rather than Kotlin what would be very useful would be a high efficiency language with a familiar syntax that was easier for beginners to learn than things like C++, Java or Kotlin.

Having said all that, if I was in my twenties I would probably be raving about how brilliant Kotlin was.