HaxeFoundation / HaxeFoundation/haxe

Viability of hxb based custom backends?

Open
#11,523 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

I expect this to be way beyond any of the immediate plans for hxb, but:

If for a moment we assume the existence of haxe based hxb reader, I can see how using hxb to integrate custom backends would make sense, where the compiler dumps hxb for another process that does the actual code generation (ideally the compiler would spawn the generator and stream the target context hxb into its stdin).

One can of course get relatively far with just doing code generation in eval, however this approach has several advantages:

1. the overhead of the intermediary hxb step can be overcompensated for on runtimes with faster execution speed and true concurrency support
2. the target's "native" tooling could be integrated, e.g. a custom C# backend of this kind could be compiled to C# and then more easily integrate other .NET tools, e.g. use [`CodeDOM`](https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/using-the-codedom) to bootstrap an IL target from there ... to overgeneralize completely: any language X with a bootstrapped compiler could in essence get Haxe integrated as a frontend via hxb, by writing a hxb -> X compiler in Haxe

There's nothing immediately actionable here (even a reader should wait for the format to stabilize), but I wanted to bring it up now, before any design decisions get frozen that might be too much of an obstacle. Perhaps @SomeRanDev has any comments based on his experience with custom backends?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.