Skip to content
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

support default implementations in native headers #40

Open
jvasileff opened this issue Oct 16, 2016 · 1 comment
Open

support default implementations in native headers #40

jvasileff opened this issue Oct 16, 2016 · 1 comment

Comments

@jvasileff
Copy link
Owner

jvasileff commented Oct 16, 2016

native headers may provide default implementations. For example:

native class C() {
    shared String defaultMember0 => "";
    native shared String defaultMember1 => "";
    native shared String defaultMember2 => ""; 
    native shared String nonDefaultMember;
}

native("dart") class C() {
    native("dart") shared String defaultMember2 => "";
    native("dart") shared String nonDefaultMember => "";
}

and toplevels

native String s => "";

For toplevel functions and values with default implementations, backend specific implementations are optional.

For toplevel classes, objects, and interfaces with default implementations for all members, it's unclear if backend specific implementations should be required.

Default members for Inner class and interface headers appear to be valid.

@jvasileff jvasileff added this to the DP4 milestone Oct 16, 2016
@jvasileff
Copy link
Owner Author

A significant challenge will be how to indicate if there is an actual native Dart language implementation for a native header. We'll need to know this in order to suppress "no native implementation for backend" errors.

The javascript approach is to require specially named files to hold the native implementations, but that's not ideal for Dart since it will make editing the native implementations much more difficult.

Perhaps:

  1. Initially use a compiler annotation, to get something that works. Then,
  2. introduce some comment syntax to be used in the *.dart code that can indicate what toplevel declarations are present. (This would be much easier than trying to parse the dart code.)

@jvasileff jvasileff modified the milestones: DP4, DP5 Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant