Elektrine lite

← Feed

@akbashev@mastodon.social

Post #1839164

2026-04-07 07:56 UTC

@rhysmorgan @mattiem isn’t it a problem for testing, actually? Cause with NonisolatedNonsendingByDefault enabled you’ll have two behaviours effectively—ViewModel for view will run on main actor isolation, and on whatever isolation for tests. Plus tests are parallel, main actor isolation helps here.

Replies (2)

  • @rhysmorgan@mastodon.social 2026-04-07 08:41

    @akbashev @mattiem MainActor-isolation doesn't help for tests, I think. It anything, it causes MainActor contention if all your tests are running in parallel, and trying to run on the MainActor. I think it's a bit like the “If everything has to be Sendable, nothing makes sense as Sendable and it should be the only option." – if everything has to be MainActor, then it should be the default you opt out from. (but pls no, that mode is fraught with problems)

    Open ##1839165

  • @mattiem@mastodon.social 2026-04-07 09:43

    @akbashev @rhysmorgan you are right that a type like this can used from any isolation, including none at all. But the compiler will prevent unsafe accesses. So if the serialization that MainActor provides is necessary anywhere, you’ll know because it will fail to build.

    Open ##1839178