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

write bang-syntax convertor #150

Closed
warner opened this issue Mar 26, 2019 · 13 comments
Closed

write bang-syntax convertor #150

warner opened this issue Mar 26, 2019 · 13 comments
Assignees
Labels
SwingSet package: SwingSet

Comments

@warner
Copy link
Member

warner commented Mar 26, 2019

We'd like to be able to use "bang syntax" in userspace Vat code: x ! foo(y). This should be converted into E(x).foo(y). This probably wants to be a plugin to our use of rollup when bundling the vat code into a single string.

If we can accomplish that, we should jump ahead to converting it into E('send', x, 'foo', y), and change the E object to match. By providing the method name as a string, we can avoid the need for a Proxy (to glean the method name when it gets looked up), which would be faster and simpler.

The original Promises proposal (http://web.archive.org/web/20161026162206/http://wiki.ecmascript.org/doku.php?id=strawman:concurrency) describes the syntax, although we might need to update some parts of it.

@katelynsills katelynsills self-assigned this Mar 26, 2019
@katelynsills
Copy link
Contributor

It looks like we will need to use Babel, and will actually have to fork the Babel parser (formerly Babylon) to be able to do this: https://babeljs.io/docs/en/next/babel-parser.html#will-the-babel-parser-support-a-plugin-system

@warner
Copy link
Member Author

warner commented Mar 27, 2019

I think rollup uses acorn (which I think is a parser), does that help us at all?

@katelynsills
Copy link
Contributor

It looks like we could write an acorn parser plugin like this one for bigint. It seems to be a lot cleaner than plugins for the Babel parser (which is explicitly not supported by them.) The only downside I can see is that an acorn plugin is probably only narrowly useful for Rollup and maybe a few other things, but almost everyone uses Babel. Rollup supports Babel, for instance. Still, it might be helpful to get it working with Acorn and then do Babel at some point in the future.

@erights
Copy link
Member

erights commented Mar 27, 2019

How similar are their ASTs?

@katelynsills
Copy link
Contributor

I'm still early in the investigation, but they appear to be very similar. Babel-parser says it's based heavily on Acorn. https://babeljs.io/docs/en/next/babel-parser.html

@erights
Copy link
Member

erights commented Mar 27, 2019

Good. In that case, if one is substantially easier to get working first, do that one. But let's plan to eventually switch to Babel.

@katelynsills
Copy link
Contributor

This has been deprioritized, but to record some of my notes:

Once this is done, we will need to add an argument to bundleSource so that the bang transformation is done for vats but not for the kernel. We will also need to throw an error if the bang transformation hasn't been explicitly enabled.

@erights
Copy link
Member

erights commented Mar 28, 2019 via email

@katelynsills
Copy link
Contributor

Brian might be able to speak to that. I'm not sure myself, but those were the instructions that I got from him. @warner

@warner
Copy link
Member Author

warner commented Mar 28, 2019

We don't have an E() wrapper inside the kernel: it expands to things like syscall.send() and manages a set of per-Vat Promises, none of which is meaningful from outside of a Vat. So I think we want to see an error if ! is used inside kernel code.

@erights
Copy link
Member

erights commented Mar 28, 2019

Good

@michaelfig
Copy link
Member

I may have a go at this for Tessie... I'm already using Babel to do the rewrites from Tessie to Jessie.

(And I would like to use Tessie to write vat code for SwingSet.)

michaelfig referenced this issue in michaelfig/SwingSet Jul 12, 2019
michaelfig referenced this issue in michaelfig/SwingSet Jul 12, 2019
michaelfig referenced this issue in michaelfig/SwingSet Jul 13, 2019
michaelfig referenced this issue in michaelfig/SwingSet Jul 13, 2019
michaelfig referenced this issue in michaelfig/SwingSet Jul 13, 2019
michaelfig referenced this issue in michaelfig/SwingSet Jul 13, 2019
warner referenced this issue in Agoric/SwingSet Jul 14, 2019
* fix promise-vs-resolver corruption in commsSlots #87
* accept bang-syntax: #6
** x!foo(args) instead of E(x).foo(args)
** works in top-level code in SES and --no-ses modes
** works in nested/runtime eval() in SES mode only
* update deps to fix lodash security alert (dup of #91)
@warner
Copy link
Member Author

warner commented Dec 4, 2019

in the old repo. this was SwingSet issue 6

@warner warner transferred this issue from Agoric/SwingSet Dec 4, 2019
@warner warner added the SwingSet package: SwingSet label Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SwingSet package: SwingSet
Projects
None yet
Development

No branches or pull requests

4 participants