HaxeFoundation / HaxeFoundation/haxe

Feature request: allow macro to handle compiler files emission

Open
#6,986 4 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

One recurring discussion is to add an API for the Haxe compiler to function in memory - this is desirable for tooling.

My last idea, to permit it without having any hard-coded protocol in the compiler is to offer macros to register a callback to emit files:
```
haxe.macro.Context.onEmitFile( callback:String->String->Void );
```
Register a callback receiving:
- `filePath`: path of the file to write
- `content`: body of the file to write

_Note: it's probably naïve and would require more options to emit binary files._

Using such API, a macro could freely:
- post-process files before write,
- or implement a custom protocol to transmit output without I/O.

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.