Comments (2)
The bot intends to work in a one code-execution / one output paradigm, which serves well its intent to primarily work as a source of actual examples and really quick tests which can run on their own. Inputs, if known in advance, can be supplied in the command (see wiki). The API used by the bot to perform code-execution, TryItOnline, cannot support an interactive approach and, besides the fact that he is currently occupied, I do not think its creator and maintainer would want to add it, the first sign being the 60-seconds limit to all executions originating from a lot of attempted abuse (which the bot suffers from too).
A REPL would only mean for the API to maintain active connections, but for the bot it would also mean keeping track of discord users invoking commands for extended periods of time while also maintaining alive sessions with the website (which can only be interacted with through the stateless HTTP protocol).
In the current state of the API, which feeds inputs line by line as the running program asks for it, no input results in an EOF which then produces varying behaviours among languages. For instance in Python you literally get an EOFError, while in Ruby the program carries on while gets
returns nil
instead of a string. For a feeling of REPL the bot would have to manipulate the result of the execution given to the end-user, ask for a missing input, then go through the whole execution again, adding the missing input, as he does not have access to the execution state (which would also be a cost to store if it had).
Moreover detecting these unfulfilled inputs after execution is not only strongly language-dependent but also hard in practice and in a lot of edge-cases. What if the Python's EOFError is caught in an except making the program crash at a different point? How will the bot tell it was because of a missing input?
Another way would be to tell before executing, (or actually before aborting the execution since we conclude it would not work anyway). This means introducing an overhead prior to all executions of the language having the feature in order to parse the user code, inputs and even compiler flags and command-line options. A parsing which is furthermore non-trivial, since you would have to tell functions from strings, and anticipate control flow which adds multiple inputs from a single call in the source, or no input because of a call not reached, this being without also taking in account edge-cases which can lead to input calls without even having the word input in the code. In the end we really are running the program twice just in order to tell an input isn't filled.
Thus this feature is not possible, as telling inputs somewhat reliably requires doing exactly what the language does, or making assumptions from the output of executions.
from rtfmbot.
from rtfmbot.
Related Issues (14)
- Provide input to code being executed HOT 2
- add mips assembly to rtfmbot HOT 1
- Executing shell commands HOT 1
- `do run` command responding twice HOT 2
- Missing f - string HOT 1
- Bot is Down
- Feature Suggestion: Prettify/Obfuscate
- Hastebin does not work anymore
- readthedocs bin HOT 1
- 'run' Refresh never respond to interaction
- database HOT 1
- Github Gist support HOT 1
- Errors with length calculation of non-ASCII characters 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 rtfmbot.