Comments (2)
Initial idea was to call language specific String representation methods (such as obj.__repr__()
for e.g. python) on foreign objects that ijavascript could not evaluate with default obj.inspect
as implemented on feature branch #13. Will revert back to " " + obj
as this seems to be cleaner approach.
from ipolyglot.
In this comment, we try to consolidate observations of different behaviors of output / error handling across languages.
We also compare the output / error handling inside Jupyter Notebook to the behavior when using the Polyglot.eval
interface inside a console node --polyglot --jvm
session to potentially spot errors which are not caused by our implementation but instead by GraalVM.
Python - stdout - Jupyter Notebook ❌
Output of print()
is not shown, NEL internal error because the execution of the last line doesn't yield anything which can be automatically converted and shown as cell output (yields null
instead).
Python - stdout - Console ✅
Behaves as expected.
> result = Polyglot.eval('python', 'a = 0\nprint(a)\na += 1');
0
null
Python - stderr - Jupyter Notebook ✅
Behaves as expected.
Python - stderr - Console ✅
Behaves as expected.
> result = Polyglot.eval('python', '<----');
Error: SyntaxError: invalid syntax
at Object.eval (native)
Ruby - stdout - Jupyter Notebook ❌
Output of puts
is not shown
Ruby - stdout - Console ✅
Behaves as expected.
> result = Polyglot.eval('ruby', 'a = 0\nputs a\na += 1');
0
1
Ruby - stderr - Jupyter Notebook ❌
No error message in Notebook, NEL internal error on Node console, kernel is stuck in execution and is unresponsive.
Ruby - stderr - Console ❌
Unrelated JS error is shown.
> result = Polyglot.eval('ruby', '<----');
TypeError: Object prototype may only be an Object or null: DynamicObject@5d75f90e<Method>
at Function.setPrototypeOf (native)
at deprecate (internal/util.js:70:10)
at formatValue (internal/util/inspect.js:481:21)
at Object.inspect (internal/util/inspect.js:191:10)
at Domain.debugDomainError (repl.js:439:34)
at Domain.emit (events.js:189:13)
at Domain.emit (domain.js:441:20)
at REPLServer.defaultEval (repl.js:353:26)
at bound (domain.js:395:14)
at REPLServer.runBound (domain.js:408:12)
R - stdout - Jupyter Notebook ❌
Output of print()
is not shown
R - stdout - Console ✅
Behaves as expected.
> result = Polyglot.eval('R', 'a = 0\nprint(a)\nb = "asdf"');
[1] 0
'asdf'
R - stderr - Jupyter Notebook ✅
Behaves as expected.
R - stderr - Console ✅
Behaves as expected.
> result = Polyglot.eval('R', '<----');
Error: parse exception
at Object.eval (native)
JS - stdout - Jupyter Notebook ✅
Behaves as expected.
JS - stdout - Console ✅
Behaves as expected.
> result = Polyglot.eval('js', 'a = 0\nconsole.log(a)\na += 1');
0
1
JS - stderr - Jupyter Notebook ✅
Behaves as expected.
JS - stderr - Console ✅
Behaves as expected.
> result = Polyglot.eval('js', '<----');
Error: SyntaxError: <eval>:1:0 Expected an operand but found <
<----
^
at Object.eval (native)
from ipolyglot.
Related Issues (20)
- Create own bin/node HOT 1
- Add inspector view element for bindings object. HOT 4
- Use language specific comments in juypter notebook.
- Investigate whether JuypterLab is suitable and needed. HOT 1
- Implement automatic variable exporting for more languages. HOT 8
- Improve variable inspector. HOT 2
- Rename ijsinstall script / clean up project. HOT 1
- Make polyglot inspector a tree view. HOT 2
- (Re-)deploy to Vm
- Error parsing Jupyter version HOT 3
- Add automatic language detection.
- error from docker: npm ERR! Failed at the [email protected] postinstall script. HOT 2
- Can not connect to ipolyglot kernel HOT 2
- Add syntax highlighting to notebook cells for different languages. HOT 1
- Use IJavaScript kernel inside GraalVM with Jupyter frontend. HOT 4
- Add support for GraalVM languages. HOT 7
- Abstract from polyglot API for importing and exporting variables. HOT 5
- Set up jupyter notebook server in VM HOT 6
- Get paper demo notebook running HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipolyglot.