language icon indicating copy to clipboard operation
language copied to clipboard

feature request: support linear types

Open aran opened this issue 9 months ago • 2 comments

Consider supporting linear types. Wild proposal for a reasonably major direction. Didn't see it discussed here or in the Google Group. Even something simple like an '@noCopy' annotation would be useful.

A few basic points:

  • Flutter's meta already has @useResult and @immutable.
  • Big help to FFI users, especially Rust interop
  • Possible performance benefits, e.g. if some data copies can be avoided. (Or the implementation is simpler if the VM already does that analysis and there's code to reuse)
  • More flexibility in SendPort.send :)

Lots of languages have bolted on linear typing or linear-like features. In Dart's case, it might make sense to do at the analyzer level at first and expose piecemeal features driven by the same underlying analysis such as something like @noCopy annotation, etc. Then a real design for the type system for Dart 5 or whatever could subsume those features.

aran avatar May 03 '24 03:05 aran