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

Remove native from implementation code, use metadata #9850

Closed
sethladd opened this issue Apr 11, 2013 · 10 comments
Closed

Remove native from implementation code, use metadata #9850

sethladd opened this issue Apr 11, 2013 · 10 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-html P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@sethladd
Copy link
Contributor

We have metadata now, we don't need secret unspecified language features.

We have external tool vendors that are trying to work with Dart, and they run into 'native' which is unspecified.

Also, not sure where to file this because it's an implementation issue, not a Language issue.

@rakudrama
Copy link
Member

Marked this as blocking #5979.

@rakudrama
Copy link
Member

We need something better specified than 'use metadata'.

  1. If the 'native' clauses are removed from the dart2js DOM implementation, the resulting program would be malformed. E.g. native methods would look abstract, even though they exist.
  2. It would impact dart2js throughput if we had to resolve all the metadata annotations just to see if the interesting ones are there. dart2js goes to great lengths to avoid parsing each class.

We do have an 'external' keyword, but that currently tied up with the 'patch' mechanism which is unsuited to the DOM libraries.

This is a related issue: Issue #9: Remove native keyword, replace with @­native annotation
I suggest we keep two issues - this one to properly specify how we should do these things, and the existing one as a work item for dart2js.

BTW the editor team did not know about "native" either, but when it was described to them, they had a CL to handle native classes and methods within the hour. It might be more efficient in the short term to simply educate the tool vendors how to work around the native 'keyword'.

@sethladd
Copy link
Contributor Author

Thanks Stephen. My point is, if our tool ecosystem has to deal with native and patch, we should either put it into the language or use language constructs. Having these "shadow" features seems weird to be, and are barriers to a richer tool ecosystem.

@DartBot
Copy link

DartBot commented May 22, 2013

This comment was originally written by Hannes.R...@gmail.com


Hi :),

currently I use the native keyword.
what would be the correct way to code it then? Is there an example for the metadata way, or should I wait and stick with native till there is a proper implementation for it?

Thanks

@iposva-google
Copy link
Contributor

Hannes, for the foreseeable future the native keyword is the way to interact with native extensions to the Dart code from the VM.

@DartBot
Copy link

DartBot commented May 23, 2013

This comment was originally written by Hannes.R...@gmail.com


Cool, thanks!

@lrhn
Copy link
Member

lrhn commented Apr 30, 2014

Is the "native" keyword used in any place except the VM patch files?

If so, could we change those other places to use "external" instead. If they need a string, that can be added as metadata, like

    @­NativeCode("whattamagonnacall")
    external foo();

?
(The VM could do that too, but patch files are not really public, so the need is very small).

If it's only the VM using it now, we can close this issue.

@lrhn
Copy link
Member

lrhn commented Apr 30, 2014

It seems that, at least, the _blink/dartium, dart2js html, js/js_dart2js and tools/dom libraries use "native" notation.

@lrhn
Copy link
Member

lrhn commented Apr 30, 2014

Added Library-Html label.

@sethladd sethladd added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-html labels Apr 30, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
@bkonyi
Copy link
Contributor

bkonyi commented Jun 27, 2018

Duplicate of #11606.

@bkonyi bkonyi closed this as completed Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-html P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants