Skip to content

noinline attribute#128

Open
jackhexed wants to merge 1 commit into
luau-lang:masterfrom
jackhexed:noinline-attribute
Open

noinline attribute#128
jackhexed wants to merge 1 commit into
luau-lang:masterfrom
jackhexed:noinline-attribute

Conversation

@jackhexed
Copy link
Copy Markdown
Contributor

@jackhexed jackhexed commented Jul 6, 2025

This RFC adds the @[inline("never")] attribute to replace the local func; function func() pattern to prevent inlining.

Rendered

@Bottersnike
Copy link
Copy Markdown

Given #49 strikes down the idea of a @inline is the motivation against @noinline valid? Personally I think it would make far more sense over a mandatory argument that's only ever a single value (especially given the syntax for arguments to attributes isn't the prettiest too).

@Dekkonot
Copy link
Copy Markdown
Contributor

Dekkonot commented Jul 7, 2025

I'm inclined to boost @noinline over @inline(never) for the reasons Bottersnike mentioned above. If we ever get an @inline attribute, we can add never as an option without too much trouble.

@jackhexed
Copy link
Copy Markdown
Contributor Author

I am happy with either.

@jackhexed
Copy link
Copy Markdown
Contributor Author

This is a simple RFC. There has been no discussion beyond @noinline vs @[inline("never")], and I am happy with both options, whichever would get this merged.

Is this is a feature that the Luau maintainers want?

@ishtar112
Copy link
Copy Markdown

ishtar112 commented Jan 7, 2026

Not mentioned as a motivation is the fact that inlined functions are [as expected] discarded from tracebacks, which can be especially problematic for debugging. Today, the only ways to prevent this are to annotate the relevant file as O0 or O1, or as the RFC mentions, to declare a function as function foo rather than local function foo -- neither of these are particularly desirable solutions, especially in comparison to a dedicated attribute. I am of the opinion that this feature is a must.

And to repeat what's already been said, I prefer @noinline over @[inline("never")].

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.

4 participants