Closed
Bug 642196
Opened 14 years ago
Closed 13 years ago
GCLI should allow JS to be entered using {}
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jwalker, Assigned: jwalker)
References
Details
(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')}
"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
4
The system may need integration with a JS parser like narcissus or uglify to allow us to recognize matching {}
Assignee | ||
Updated•14 years ago
|
Whiteboard: [estimate:best=3d,likely=5d,worst=10d]
Assignee | ||
Updated•14 years ago
|
Blocks: GCLI-EXPERIMENT
Assignee | ||
Updated•14 years ago
|
No longer blocks: GCLI-EXPERIMENT
Assignee | ||
Updated•14 years ago
|
Blocks: GCLI-FUTURE
Comment 1•14 years ago
|
||
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>
Thoughts?
Assignee | ||
Comment 2•14 years ago
|
||
I suggested {} for 2 reasons:
- it allows something after the JS
- {} already has the notion of containment in JS.
Comment 3•14 years ago
|
||
{} 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?
Assignee | ||
Comment 4•14 years ago
|
||
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?
Comment 5•14 years ago
|
||
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.
Comment 6•14 years ago
|
||
another alternative syntax that will make a bit more sense if this becomes spec:
{||} block syntax.
http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival
(or even {|} with no block arguments.
e.g., {| // some javascript }
Assignee | ||
Comment 7•14 years ago
|
||
Nice idea, thanks Rob.
Assignee | ||
Updated•13 years ago
|
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → jwalker
Whiteboard: [estimate:best=3d,likely=5d,worst=10d] → [minotaur][best:3d, likely:5d, worst:10d]
Assignee | ||
Updated•13 years ago
|
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•