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
Description
This would help with:
- Support for different module systems (integrate with existing JS module systems #284)
- Closure Compiler output (with fully-annotated runtime primitives)
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:
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ochafik commentedon Sep 8, 2015
Started experimenting in branch passthrough-js-interop.
jmesserly commentedon Sep 8, 2015
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 commentedon Sep 8, 2015
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.
[-]Support JS intrinsics to write all of the runtime in Dart.[/-][+]Write all of the runtime in Dart.[/+]ochafik commentedon Oct 16, 2015
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 underdart/*
if they're generated from the sdk input, as there is quite a bit ofdart:
scheme-specific logic in the compiler (anddart_runtime
is not a valid scheme as it contains an underscore).That is, for instance,
dart_runtime.js
currently defines adart_runtime/dart
module, but we might want the new equivalent_dart_runtime.dart
to define adart._dart_runtime
library instead.Regarding what to start with:
(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)jmesserly commentedon Oct 16, 2015
@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 commentedon Oct 16, 2015
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 commentedon Oct 16, 2015
@jacob314 I'm toying with a
@varargs
annotation for params +varargs(args) -> ...args
argument transform in branch runtime-varargs, WDYT?jacob314 commentedon Oct 16, 2015
I'm open to adding '''@VarArgs''' to package:js with the other js interop specific annotations.
ochafik commentedon Oct 19, 2015
@jacob314 Cool! Filed dart-lang/sdk#24623 to track :-)
Move runtime js files down to lib/runtime/dart
Compile package:js.{rest, spread} helpers.
Convert dart_utils.js to input_sdk/lib/_internal/utils.dart (#310)
Convert dart_utils.js to input_sdk/lib/_internal/utils.dart (#310)
Convert dart_utils.js to input_sdk/lib/_internal/utils.dart (#310)
JS: Format if statements with no else on a single line
Generate _runtime.js from dart (#310)
jmesserly commentedon Jan 21, 2016
🎉
Move runtime js files down to lib/runtime/dart
Compile package:js.{rest, spread} helpers.
JS: Format if statements with no else on a single line
Generate _runtime.js from dart (dart-archive/dev_compiler#310)