haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Add `only_new` option to `haxe.macro.Context.onGenerate`

Open Apprentice-Alchemist opened this issue 6 months ago • 4 comments

If only_new is set to true then only new types (aka not cached) will be passed to the callback.

@SomeRanDev wants this for Reflaxe.

Apprentice-Alchemist avatar Jun 21 '25 19:06 Apprentice-Alchemist

I'm fine with this, though I'm slightly worried about the overall approach here because we're already at 4 permutations with persistent and new. I can't immediately tell how else to handle this though.

Happy to merge this once Reflaxe/C# is working!

Simn avatar Jun 21 '25 19:06 Simn

I'd also like to take a proper look at that (monday, if I don't forget about it)

kLabz avatar Jun 21 '25 20:06 kLabz

Happy to merge this once Reflaxe/C# is working!

💦💦💦 ... it works... just uhh... 💦 need to use a VERY RESTRICTED subset of Haxe code 💦💦💦

an EnumFlags argument could be nice; could use the int as a key to cleanup the lists into a larger list/PMap.t?

SomeRanDev avatar Jun 21 '25 23:06 SomeRanDev

I don't really like the duplication of callback lists for _only_new variants, as (though admittedly that won't matter in 99.9% of cases) order might not be intuitive (all on_generate callbacks with only_new = false run, then all on_generate callbacks with only_new = true)

Can you add a test so that we can try different approaches while still making sure the feature works as expected?

kLabz avatar Jul 01 '25 08:07 kLabz