HaxeFoundation / HaxeFoundation/haxe

Something to add metadata/extern flag to KModuleFields class

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

Description

*(extracted from #9436)*

We have to design some non-hacky way to attach metadata to `KModuleFields` classes. There are a lot of important metas that can be applied to them, like `@:build`, `@:cppInclude`, `@:hlNative`, `@:dce`, etc.

Also, marking a module class `extern` together with `@:native`/`@:jsRequire`/etc. looks pretty useful.

I haven't really tried, but I _think_ it is currently possible to achieve this by using init macros, like `addMetadata` and `exclude`, but that's obviously a confusing, flimsy and error-prone option, hence this issue.

Here are some options that come to my mind right away:

- "magic" module declaration, like `@:build(...) class $module {}` or `@:build(...) final $module;` - it's not very pretty, but it doesn't introduce new syntax and allows for creating such modules with existing macro api with `Context.defineModule`.

- some specific module-level syntax, like `(@:build(...))`, `$ @:build(...)` or something - can look nicer, but it's new syntax, which raises questions about macro representation and tooling support.

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.