Skip to content

Consider making breaking change of making dart:io APIs return deeply immutable bytes. #50069

Open
@mkustermann

Description

@mkustermann

The VM has support for sharing deeply immutable typed data across isolates. Though it is cumbersome to create such deeply immutable typed data - especially if one wants to avoid an additional copy (see e.g. dart-lang/sdk/issues/50068).

Many typed data instances originate from outside dart code (e.g. loaded from filesystem, socket / http, etc). When that data is read, it is very rarely modified.

So I propose making all dart:io APIs return deeply immutable bytes. It would be a breaking change due to a very small percent of use cases where such data is actually modified, those places would need to be updated.

Though the benefit (all dart:io returned bytes are sharable across isolates by-pointer) seems to outweigh the cost to me (very rare case of modifying such bytes).

The breaking change would not necessarily imply we have to change the actual types of the API (though that would be an option)

/cc @lrhn opinions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions