Skip to content

[FEATURE] Null-safe field assign #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

NotHyper-474
Copy link

@NotHyper-474 NotHyper-474 commented Jul 24, 2025

Description

Basically adds support for doing stuff like obj?.x = True.... This would grant you a compile error in Haxe 4 but doesn't in 5 so why not 🤷
The way it works is that ?. basically becomes a ternary except it assigns the field inside its block.

Shoutout to Keoiki for the idea.
image

@NotHyper-474 NotHyper-474 force-pushed the feat/nullsafe-assign branch from ee46aa8 to 6a6e88a Compare July 24, 2025 03:26
@NotHyper-474
Copy link
Author

Oh yeah this isn't really foolproof so don't ever dare doing something like a = x?.y = 2 or else a is just gonna become null if x is null.

@NotHyper-474 NotHyper-474 force-pushed the feat/nullsafe-assign branch from 2f9d871 to 1fdede2 Compare August 5, 2025 19:21
@EliteMasterEric EliteMasterEric merged commit 02c7d78 into FunkinCrew:funkin-dev Aug 8, 2025
@NotHyper-474 NotHyper-474 deleted the feat/nullsafe-assign branch August 8, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants