3 ms·
Before anyone gets too excited, make sure you look at what a compiler using Truffle actually looks like, and remember that Java is far from an ideal language fo
by wcrichton 10y ago
Before anyone gets too excited, make sure you look at what a compiler using Truffle actually looks like, and remember that Java is far from an ideal language for writing a compiler. I'll use their SimpleLanguage (their primary tutorial lang) as an example.
Parser [1] shows how lack of sum types makes code messy. Lots of "factory.createStringLiteral" kind of calls. At least Java has a mature parser generator.
Implementing interpreter nodes [2] requires a pretty large amount of boilerplate, each individual node is relegated to its own file, some classes are littered with probably autogenerated getters/setters. While functional languages can be too terse, Java shows its exceptional verbosity here.
[1] https://github.com/graalvm/truffle/blob/master/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SimpleLanguage.atg https://github.com/graalvm/truffle/blob/master/truffle/com.o...
[2] https://github.com/graalvm/truffle/tree/master/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes https://github.com/graalvm/truffle/tree/master/truffle/com.o...
- alehander42 10y agoWell can't we just use another language for JVM (e.g. Kotlin or Scala)
- wcrichton 10y agoHopefully! I would love to see a Truffle language written in Scala, although some of the DSL stuff I've seen in Scala (e.g. Delite) is still pretty verbose. I feel like the missing piece is quasiquotations--writing the code generation step would be a lot easier with those.
- qwertyuiop924 10y agoUrrgh. This just reminds me of why I gave up on android app development, and the JVM ecosystem as a whole: it tests my ability to put up with bullshit.
- deleted 10y ago[deleted]
- eggy 10y agoI agree. I wanted to really write native Android apps, not HTML5 or even use the NDK with C/C++. It is just too much stuff. The downloads, the verbosity of Java, the lack of a slick toolchain (Android Studio is getting close, I guess), and a slew of other incoherencies. I don't cut slack for Obj-C on iOS either. I've had great fun with two products for Android/iOS and Mac/PC/Linux: [1] Godot game engine. I followed the introduction and had an app on my Android phone in 10 minutes. A little hack in the background, but hey, for gaming it is great. [2] 8th - a dialect of Forth - you write Forth-like 8th, and voilà it's running on your Anroid, PC, Mac, iOS device! [1] https://godotengine.org/ https://godotengine.org/ [2] http://8th-dev.com/about8th.html#cross http://8th-dev.com/about8th.html#cross
- qwertyuiop924 10y agoI have not used godot up to now, as I am wary of engines that require me to learn a scripting language used nowhere else. Is it any good? Oh, and I've heard React Native's not so bad for mobile.
- eggy 10y agoI have not tried more than about 8 game engines, so my opinion is limited. Godot is very good: * Very customizable interface * Lots of tutorials on YouTube and elsewhere * Good examples provided * Script is very similar to Python, so not too hard to pick up, and again, lots of examples. * Easy packaging for Android, Windows, and Linux on my end * MIT license, commercial or non-commercial * 2D/3D and live debug and scripting on the fly Really worth trying out, since it is easy to install and dive in. I'll have a look at React Native, but I am not a JS programmer, and all of these 'hot' JS libs, modules, etc... seem more cluttered than plain old JS. I think if I were to branch out, I'd try Purescript instead.
- qwertyuiop924 10y agoIf you're thinking along the lines of Angular, React is very different (less clutter, nice design, emphatically not a framework), and has inspired many re-implementations of its ideas. It's probably more worth checking out that most of what's out there.
- grashalm 10y agoPartial Evaluation requires very precise knowledge of the bytecodes which are feeded into it. Having eg. Scala abstractions showing up suddenly would be quite annoying. Java is closest to bytecodes thats why we use it for Truffle interpreters.