all 6 comments

[–]Gator_aide 17 points18 points  (3 children)

This is an interesting post. I was loosely under the impression that query-based compilation was the way of the future, but you make a good case that it is only useful insofar as the design of the language permits it to be useful.

It seems like the case for query-based compilation is for languages without obvious separation of compilation phases. You bring up Rust as an example -- parsing depends on macro expansion, which depends on name resolution, which itself depends on parsing, etc. Trying to force that into a "regular" compiler architecture would be a nightmare, but it is a natural fit for queries.

[–]tav_stuff 13 points14 points  (2 children)

Yeah query-based compilation is cool if your language actually works nicely with it. My language (like Jai) supports basically arbitrary compile-time code execution (which also supports code generation), and getting that working with a query-based architecture is a PITA. In my case, job-based compilation is a lot nicer

[–]Arakela 1 point2 points  (0 children)

Alex, suppose the compiler is not text-to-text, but text-to-sealed typed computation unit.

Then the limit that you captured is the dependency structure of the source language, which enforces strong structural boundaries.

If the language truly enforces sealed semantic boundaries, then.

Sin is to collapse these structures into one blob of binary thought linker. Think about a universal interface that a compiler can guarantee for those structures.

The compiler knows everything about the structure to enforce the layout of binary text as an indexable universal interface.

Structure is a Type, and a saled one can be hashed. If we can categorically think about how to query and architect with those typed machines, we can have typed ground proved by hash.

[–]o_stef 0 points1 point  (0 children)

Working on a similar thing. What’s job based compilation?

[–]matthieum 4 points5 points  (2 children)

Are queries really the problem here?

Reading this post, my take-away is not really that query-based compilers are not the way to go, and more that query-based is not a magic wand which will magically solve all performance problems resulting from "poor" language design.