Skip to content

Null<T> #3

@Simn

Description

@Simn

One of the biggest challenges when it comes to Haxe code generation is the handling of Null<T>. My experience is that it's good to get this out of the way early because otherwise it's going to come back with a vengeance.

The problem with C# Nullable is that it is constrained to struct. This means that it cannot be used with reference types, which in turn means that it cannot be "blindly" used in place of Haxe's Null<T>. Unfortunately, I don't remember what exactly the problem was with an approach that would emit Nullable only if the parameter is not a reference type.

The C# target has its own Null implementation that doesn't have the struct restriction. However, this has always caused some friction and doesn't seem ideal either.

I'm interested in knowing what the best approach is in the C# world!

Metadata

Metadata

Assignees

Labels

TODOBig todo feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions