Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Write all of the runtime in Dart. #310

Closed
@ochafik

Description

@ochafik

This would help with:

Note that this would imply changing the signature of a couple of vararg functions (dart.mixin, dart.fn...).

There are a couple of files that need translation as they produce modules:

The following helper file needs to be converted to a module:

  • dart_utils.js (d91add0)

Then the following file is used to support the current module system, so we might not want to translate them:

Activity

ochafik

ochafik commented on Sep 8, 2015

@ochafik
ContributorAuthor

Started experimenting in branch passthrough-js-interop.

jmesserly

jmesserly commented on Sep 8, 2015

@jmesserly
Contributor

yeah, the methods that take rest arguments are a problem. @jacob314 @vsmenon any thoughts on how we can encode it in such a way DDC understands?

Other than that, do we need anything other than the existing "JS" builtin? dart2js implements the SDK with it, so it should be pretty powerful.

edit: and we also have Jacob's interop which allows "direct" calls to JS members. So we might be able to use that as well.

jmesserly

jmesserly commented on Sep 8, 2015

@jmesserly
Contributor

oh, we also need a way to get DDC to stop emitting type assertions around JS builtin expressions. Either fixing how we parse the type strings, or just trusting them and allow it to be assigned to any type.

changed the title [-]Support JS intrinsics to write all of the runtime in Dart.[/-] [+]Write all of the runtime in Dart.[/+] on Sep 14, 2015
ochafik

ochafik commented on Oct 16, 2015

@ochafik
ContributorAuthor

Regarding rest params, seems like an ad-hoc annotation such as @varargs could do the trick.

Note that dart_runtime/* modules might need to be relocated under dart/* if they're generated from the sdk input, as there is quite a bit of dart: scheme-specific logic in the compiler (and dart_runtime is not a valid scheme as it contains an underscore).

That is, for instance, dart_runtime.js currently defines a dart_runtime/dart module, but we might want the new equivalent _dart_runtime.dart to define a dart._dart_runtime library instead.

Regarding what to start with:

  • It's unclear if any file is easier to translate before the others, as there's quite a bit of interdependence
  • We can adopt rest parameters in our .js helpers, which will make the translation slightly easier.

(side-note: JS('', '...') can be used to wrap arbitrary payload without type assertions, and its parsing limitations - no ES6 support - seem straightforward to work around)

self-assigned this
on Oct 16, 2015
jmesserly

jmesserly commented on Oct 16, 2015

@jmesserly
Contributor

@ochafik -- do you mind moving your checklist into the first message, or do you mind if I do it? GitHub has some special UI magic for checklists, but it only seems to kick in if they're in the initial bug report comment :)

jacob314

jacob314 commented on Oct 16, 2015

@jacob314
Contributor

Some support for rest parameters would be very helpful for JS interop in general. This is one of the of edge cases we have to hack around today.

ochafik

ochafik commented on Oct 16, 2015

@ochafik
ContributorAuthor

@jacob314 I'm toying with a @varargs annotation for params + varargs(args) -> ...args argument transform in branch runtime-varargs, WDYT?

jacob314

jacob314 commented on Oct 16, 2015

@jacob314
Contributor

I'm open to adding '''@VarArgs''' to package:js with the other js interop specific annotations.

ochafik

ochafik commented on Oct 19, 2015

@ochafik
ContributorAuthor

@jacob314 Cool! Filed dart-lang/sdk#24623 to track :-)

added a commit that references this issue on Jan 21, 2016
jmesserly

jmesserly commented on Jan 21, 2016

@jmesserly
Contributor

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @ochafik@jmesserly@jacob314

      Issue actions

        Write all of the runtime in Dart. · Issue #310 · dart-archive/dev_compiler