HaxeFoundation / HaxeFoundation/haxe

Add "final" inference

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

Description

We currently disable some optimizations such as tail recusion elimination and purity inference for _non-final instance methods_ based on the fact that we cannot make assumptions about them, since they can be overriden later by users of haxe-generated code.

While this is a safe bet, I believe it is actually rare when Haxe code is used like that, and it would be more beneficial to actually infer and set `final` for both classes and methods. It would enable both Haxe and target-native optimizations and would still be safe to use from outside (if target language supports checking for `final`). It would also benefit code that does not use inheritance much.

Of course, it should be opt-in, so how about `-D infer-final`?

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.