HaxeFoundation / HaxeFoundation/haxe
Feature request: allow macro to handle compiler files emission
- 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
Assessment
This issue has not been assessed yet.