Boa: Feature Request: Boa Shell

Created on 10 Jul 2019  路  7Comments  路  Source: boa-dev/boa

Similar to SpiderMonkey's jsshell, or V8's d8, this is needed to create an eshost agent.

./target/debug/bin is almost that, but needs:

  1. output written to stdout

    1. only outputs the result of the last evaluation.

  2. errors written to stderr

Things needed in the shell runtime itself:

  1. print() function in the global scope (or similar). SpiderMonkey's JavaScript shell defines this as:
    > Evaluates the expression(s) and displays the result(s) on stdout, separated by spaces (" ") and terminated by a newline ("\n").
  2. globalThis or similar mechanism
  3. Some way to create a new realm and global object, eg. jsshell's newGlobal() or d8's Realm.global(realmId) (which requires some way of making a realmId, ie. Realm.create() or Realm.createAllowCrossRealmAccess())
  4. Some way to evaluate a string of source code, eg. jsshell's evaluate(code) or d8's Realm.eval(realmId, code)
enhancement help wanted cli

All 7 comments

Thanks @rwaldron im sure we can get onto this.

@rwaldron what would happen if you pass an object to print(), would it call toString() on that object?

@jasonwilliams sorry I missed your question! It may be easier to point you to SpiderMonkey's print(): https://github.com/mozilla/gecko-dev/blob/master/js/src/shell/js.cpp#L2687-L2724

Some way to create a new realm and global object, eg. jsshell's newGlobal() or d8's Realm.global(realmId) (which requires some way of making a realmId, ie. Realm.create() or Realm.createAllowCrossRealmAccess())

@rwaldron do you have an example of Test262 using this somewhere so we can see for context?
Edit:
Found this https://github.com/patil215/v8/blob/bb941b58df9ee1e4048b69a555a2ce819fb819ed/test/mjsunit/cross-realm-filtering.js

I think that something that might be missing here is the ability to create multiline blocks in the shell, if we want to complete it further. But for the rest, this is mostly done, right?

I think that something that might be missing here is the ability to create multiline blocks in the shell, if we want to complete it further. But for the rest, this is mostly done, right?

We have pretty much implemented all of the feature shell request.

Maybe we should close this issue in favor of the new issue #341

I鈥檓 happy to close this also

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neeldug picture neeldug  路  3Comments

HalidOdat picture HalidOdat  路  5Comments

attliaLin picture attliaLin  路  3Comments

HalidOdat picture HalidOdat  路  3Comments

jasonwilliams picture jasonwilliams  路  4Comments