GCLI should allow JS to be entered using {}




Developer Tools
7 years ago
6 years ago


(Reporter: jwalker, Assigned: jwalker)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [minotaur][best:3d, likely:5d, worst:10d])

Previous developer tool command lines have been primarily JS based. While this is somewhat limiting, it does allow easy interaction with the DOM and JS data. GCLI should allow this access using something like the following:

> echo {window.title}
"Enter Bug"

> {console.log('hi')}

It is expected that the command line will have a toggle switch to allow JS input to be the default.

The system will allow JS to be the default, allowing use of JS without either "{}" or the toggle switch:

> eval 2+2

The system may need integration with a JS parser like narcissus or uglify to allow us to recognize matching {}
Whiteboard: [estimate:best=3d,likely=5d,worst=10d]
Blocks: 642229
Depends on: 653979
No longer blocks: 642229
Blocks: 659052
Kind of a non-sequitor:

The ipython enhanced python shell uses `!` to distinguish shell commands from python code.

For example, this is interpreted as python:

    > foo = 5

and this would be a shell command:

    > !ls -al

Would it make sense to alias "eval" to "!"? I think "eval" is quite long, and though it is useful for learning the GCLI, as soon as you know it you want something more concise:

    > <normal commands>
    > !<arbitrary javascript>

I suggested {} for 2 reasons:
- it allows something after the JS
- {} already has the notion of containment in JS.
{} is used for defining an object literal. Using it as a wrapper for code to evaluate could be confusing.

I'm not sure I like the ! notation either for a more modern shell either. That makes sense in a non-graphical environment like iPython (or Bash or whatever). It makes less sense in a "graphical" command line. Could we toggle Eval mode with a button + keyboard shortcut combo?
The confusion between {} for defining a block and for defining an object literal isn't *that* great though is it?

And wouldn't most web developers that are going to want to type JS into the command line already get the dual uses?
yeah, no doubt. It's just kind of a strange case of overloading.

Evaluating JS seems like it might be a special enough case that it could warrant some additional UI. Just a thought.
another alternative syntax that will make a bit more sense if this becomes spec:

{||} block syntax.


(or even {|} with no block arguments.

e.g., {| // some javascript }
Nice idea, thanks Rob.
Blocks: 675923
No longer blocks: 659052
Assignee: nobody → jwalker
Whiteboard: [estimate:best=3d,likely=5d,worst=10d] → [minotaur][best:3d, likely:5d, worst:10d]
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.