HaxeFoundation / HaxeFoundation/haxe

Inline nullable basic types without allocations

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

Description

At the moment `Null` and `Null` used exclusively in one scope create unnecessary allocations on static platforms.

The compiler could inline those away like it does for anonymous structures:
```haxe
var a: Null = 5;
var b: Null = null;
if (a != null)
trace(a);
```
This is functionally the same as:
```haxe
var a_null: Bool = false;
var a_val: Int = 5;
var b_null: Bool = true;
var b_val: Int;
if (!a_null)
trace(a_val);
```

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named; begin by locating the compiler handling for nullable basic types and the existing anonymous-structure inlining. Done means single-scope Null and Null values on static platforms are represented without allocations while preserving the nullable behavior shown in the examples.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.