Skip to content

feat: support @trusted { ... } and @system { ... } block syntax - #24010

Open
nordlow wants to merge 1 commit into
dlang:masterfrom
nordlow:feature/safety-statement-blocks
Open

nordlow wants to merge 1 commit into
dlang:masterfrom
nordlow:feature/safety-statement-blocks

Conversation

@nordlow

@nordlow nordlow commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Allow @trusted { STATEMENTS... } and @System { STATEMENTS... } as shorthand for () @trusted { STATEMENTS... }(); and () @System { STATEMENTS... }(); in statement and expression contexts.

Add tests in compiler/test/compilable/safety_blocks.d and compiler/test/runnable/safety_block.d, and add changelog entry.

Allow @trusted { STATEMENTS... } and @System { STATEMENTS... }
as shorthand for () @trusted { STATEMENTS... }(); and
() @System { STATEMENTS... }(); in statement and expression contexts.

Add tests in compiler/test/compilable/safety_blocks.d and
compiler/test/runnable/safety_block.d, and add changelog entry.
@nordlow
nordlow force-pushed the feature/safety-statement-blocks branch from 61c380c to 2bb31a7 Compare October 11, 2026 14:23
@Herringway

Copy link
Copy Markdown
Contributor

This feature reeks. @trusted lambdas should not even have been allowed, much less be encouraged with special syntax sugar like this. It tramples all over the basic premise that @trusted functions have a verified interface.

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.

2 participants