Skip to content

Add safe mode#25307

Open
odersky wants to merge 4 commits intoscala:mainfrom
dotty-staging:add-safe-mode
Open

Add safe mode#25307
odersky wants to merge 4 commits intoscala:mainfrom
dotty-staging:add-safe-mode

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Feb 18, 2026

Add safe mode, enabled by language import

  import language.experimental.safe

This is intended to define a language subset that can be safely used in agent-generated code.

 - Nothing is yet enforced, this is just about setting and propagating the modes.
 - New: safe implies separationChecking implies captureChecking. No need to give more thasn one import.
But do check all mutable effects under safe mode.
Check that references in safe mode are safe or assumed-safe.

Turn assumeSafe from a language import to an annotation, complemented by
@rejectSafe.
@odersky odersky requested a review from a team as a code owner February 18, 2026 18:19
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

Comments