Skip to content

[vm/ffi] struct inheritance #37298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dcharkes opened this issue Jun 18, 2019 · 2 comments
Closed

[vm/ffi] struct inheritance #37298

dcharkes opened this issue Jun 18, 2019 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi type-design

Comments

@dcharkes
Copy link
Contributor

Should we allow subtyping of structs?

import dart:ffi show Struct, Int8;

A extends Struct {
  @Int8()
  int x;
}

B extends A {
  @Int8()
  int y;
}

Where B has all the fields of A.

/cc @sjindel-google

@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi type-design labels Jun 18, 2019
@sjindel-google
Copy link
Contributor

I don't see a reason to allow it -- it's not widely defined in native ABIs.

@sjindel-google
Copy link
Contributor

We won't support it since you can't extend structs in C. Also, it's semantically the same as composition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi type-design
Projects
None yet
Development

No branches or pull requests

2 participants