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

Displaying function body #44

Closed
slavaGanzin opened this issue Sep 27, 2015 · 4 comments
Closed

Displaying function body #44

slavaGanzin opened this issue Sep 27, 2015 · 4 comments

Comments

@slavaGanzin
Copy link

I recently switched to your kernel from notablemind's one.
And what I miss for is displaying body of function. I think this is by design but why?

jupyter-nodejs:
> a = -> a
> a
function a ( ) {
return a;
}

and not just [Function a] which is more expected by design of javascript, but meaningless a bit too.

This is quite helpful when you write something functional, composed from small pieces.

@n-riesco
Copy link
Owner

It is how util.inspect outputs a function. You can get the other output by calling .toString() instead, e.g.:

In[1]: a = -> a
Out[1]: [Function]
In[2]: a.toString()
Out[2]: 'function () {\n return a;\n}'

@slavaGanzin
Copy link
Author

So can I add to iJavascript automatically toString application if inspect return [Function ***] ?

@n-riesco
Copy link
Owner

It's more complicated than that. What output would you like for {a: -> a}?

@slavaGanzin
Copy link
Author

Plain js would be preferred.

n-riesco added a commit that referenced this issue Oct 2, 2015
* Updated IJavascript and the tests to use the latest NEL package,
  v0.1.x.

Closes #44
Fixes #45
n-riesco added a commit to n-riesco/jp-babel that referenced this issue Oct 10, 2015
* Previously, the output representation of functions was formatted as
  "[Function: name]". This output was generated using `util.inspect()`
  in Node.js.

* Now, the output is generated using the method `Function#toString()` in
  the Javascript standard library. This output is the Javascript
  representation of the function.

* The same change has been applied to inspect requests (shift-TAB).

Fixes n-riesco/ijavascript#44
n-riesco added a commit to n-riesco/jp-coffeescript that referenced this issue Oct 10, 2015
* Previously, the output representation of functions was formatted as
  "[Function: name]". This output was generated using `util.inspect()`
  in Node.js.

* Now, the output is generated using the method `Function#toString()` in
  the Javascript standard library. This output is the Javascript
  representation of the function.

* The same change has been applied to inspect requests (shift-TAB).

Fixes n-riesco/ijavascript#44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants