Skip to content
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

More Lambda inlines #11148

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open

Conversation

RblSb
Copy link
Member

@RblSb RblSb commented Apr 14, 2023

Removes passed function allocations by default, which seems better to me, than 5-6 more generated lines instead of Lambda call?
If this is too much, for some reason, i can only keep internal early returns changes to make inline arr.find(...) work.
There is also little null safety hack around #11077

let rec traverse arg_num args types meta =
match (args, types, meta) with
| (arg :: args, (arg_name, optional, t) :: types, arg_meta :: meta) ->
let unsafe_argument = contains_unsafe_meta arg_meta in
let unsafe_argument = contains_unsafe_meta arg_meta || expr_with_unsafe_meta arg in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need that?
Couldn't you just do if (@:nullSafety(Off) f(v)) ? (which also happens to be at least somewhat readable)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will disable null safety for inlined function code, see:

final f = [1, 2, null, 3].find(item -> {
	item++; // should error
	item == 2;
});

Current change only casts argument type instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😕 this both feels a bit hacky on compiler side and very ugly on haxe side imo

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.

None yet

2 participants