top | item 39239778

(no title)

grashalm | 2 years ago

Pkl was built using the GraalVM Truffle framework. So it supports runtime compilation using Futamura Projections. We have been working with Apple on this for a while, and I am quite happy that we can finally read the sources!

https://github.com/oracle/graal/tree/master/truffle

Disclaimer: graalvm dev here.

Edit: typo

discuss

order

krajzeg|2 years ago

> ...GraalVM Truffle framework... Futurama Projections...

I know it's partly on me for not knowing the domain, but I honestly suspected somebody is trying to make fun of me with some concentrated technobabble.

Especially since I wouldn't expect the topic (configuration languages) to require complex mathematical machinery to work with. Now I have something interesting to dig into.

TimTheTinker|2 years ago

What has most impressed me about GraalVM and Truffle is their capability of deep-optimizing high-level code like Python and Ruby.

I once saw a demo where someone took a simple operation in Ruby using inefficient-but-elegant syntax (including creating and sorting an array, where a simple loop would have been the appropriate approach in C). He compiled that using TruffleRuby and the entire array construction and sorting was completely optimized out of the generated bytecode.

Xiol32|2 years ago

Really glad it wasn't just me. Genuinely thought someone was trying to make a joke.

EPWN3D|2 years ago

Glad I'm not the only one who had this reaction. I just can't bring myself to accept that a problem that could be solved with a slightly better version of JSON or property lists requires this many buzzwords.

junon|2 years ago

Genuinely read "Futurama Projections" and figured the same. This doesn't sound real (though I fully trust it is, just sounds funny).

konstante|2 years ago

>...suspected somebody is trying to make fun of me...

I think that too, "Futamura projections" are important but they are very very far from "complex mathematical machinery" as you may hear it. They are indeed very simple (even mathematically trivial) and require no special background to understand.

leonheld|2 years ago

> but I honestly suspected somebody is trying to make fun of me with some concentrated technobabble

Let me tell about a revolutionary device called a Turbo encabulator.

Cthulhu_|2 years ago

It makes me think of this game, basically "pokemon or technobabble". Can't find it now though.

pushedx|2 years ago

> Futamura

not Futurama :D

stockholm|2 years ago

This comment is what PKL is going to be remembered for. Tbh I wouldn’t even have the courage to write the comment myself as the framework was coming from Apple.

jgrahamc|2 years ago

> Pkl was built using the GraalVM Truffle framework. So it supports runtime compilation using Futamura Projections.

What now?

pdpi|2 years ago

As I understand it:

GraalVM is an alternate JDK that can, among other things, do ahead-of-time compilation for Java.

Truffle is a framework for building languages, that sits on top of Graal.

Futamura Projections are a particularly interesting use case for compile-time partial evaluation.

With partial evaluation you have static (known at compile time) arguments to your function, and dynamic (known at runtime) arguments.

When “your function” is an interpreter, and your static arguments are source code, the output is effectively a self-contained compiled binary.

When your function is an interpreter, and the static arguments are the source code for the interpreter itself, that “self-contained compiled binary” is now itself a compiler.

verticalscaler|2 years ago

On tonights episode of Futurama bender and the gang explore the temple of Pkl on planet VM where truffles are considered the holy graals and barely run away in time from - The Compilations - an ancient secretive order of silver voiced kong-fu monks tasked with protecting the shrine from alien invaders as has been foretold in prophecies - and strangely reminiscent of 20th century Earth doo-wop group The Drifters.

Cue chase montage shenanigans with Under The Boardwalk playing in the background

Do you smell toast.

txdv|2 years ago

A LOT of projects in the Java world do add new features to java. My favorite is CraC

catchnear4321|2 years ago

new game: llm hallucination, attempt at humor, or legitimate technical explanation.

cyanydeez|2 years ago

all I saw was oracle

lpage|2 years ago

Your mention of Futamura Projections was a nice reminder of how very mathy/theoretical foundations underpin Nice Things in high-level languages, like Hindley–Milner inspired type systems and modern optimizing compilers targeting SSA form. Value Lattices in Cue [1], another config programmable configuration language, also fall into this bucket.

[1]: https://cuelang.org/docs/concepts/logic/

corysama|2 years ago

Currently using Cue in a major project. It can be a puzzle. But, we like it a lot. Wish it had a bigger community.

SirGiggles|2 years ago

Not completely related to the OP, but is Truffle going to be upstreamed as part of Project Galahad or will it remain as a library maintained by Oracle Labs?

I ask cause the Project Galahad page on openjdk.org is a bit sparse on details.

grashalm|2 years ago

The truffle compiler extensions in Graal will be part of Galahad. For example the partial evaluator. The truffle framework and all the languages are consumed from a maven repo as a regular java library these days.

Some background on the recent changes there: https://medium.com/graalvm/truffle-unchained-13887b77b62c

summerlight|2 years ago

It'd be interesting to understand what kind of performance problem Apple had and tried to solve with GraalVM/Truffle. I've seen some instances of heavy configs that generate literally several gigabytes of data, but those were usually not significant bottlenecks since configs are not updated very frequently.

Of course, I know those two frameworks are one of the engineering marble of the age and would understand even if they decided to go without any concrete needs for it.

simonfxr|2 years ago

I guess you mean Futamura projections?

lionkor|2 years ago

I wish people named more tech products after popular media instead of common words. Would make it equally hard to web search, but at least it would be funny for non-techies to listen to

grashalm|2 years ago

Damn you autocomplete! This happens all the time :D

aardvark179|2 years ago

Oh wow, this wasn’t the sort of language I expected to see being built on Truffle, but I’ll be really interested to take a closer look when I’m on a decent net connection.

Hixon10|2 years ago

Do you know, why they use both ANTLR and Truffle?

grashalm|2 years ago

Truffle has no opinion on how you parse the sources. It cares about how you execute them from an intermediate Truffle guided representation produced by the parser.

In other words antlr and truffle are a great fit. We even use this pairing for our example language simplelanguage.

https://github.com/graalvm/simplelanguage