digitalmars.D.learn - repl like interface with D app
- Mike B Johnson (19/23) Jun 16 2017 I am developing a D app and I have a need to test things out. I
- Seb (3/7) Jun 16 2017 There is drepl, it's not fancy, but works for basic use cases...
- Mike B Johnson (16/24) Jun 16 2017 But that doesn't interface with ones own program? I'm not talking
- Sameer Pradhan (7/30) Jun 16 2017 Please check out:
- Mike B Johnson (5/13) Jun 16 2017 Thanks, not sure if this will work and I don't like python much,
I am developing a D app and I have a need to test things out. I do not want to have to recompile the app every time I want to test some functionality out. Suppose I have an app with some functions like foo, bar, etc... in some module m. I would like to be able to do basic stuff likewriteln(m.foo());orauto x = m.bar() + 3;etc... This way I can write the functions, compile, then test them out without compiling. e.g.,m.FlipLightSwitch(34);which turns on the 34th light in the house, thenm.FlipLightSwitch(34);which turns it off. This should take about 1-2 seconds to test RATHER than about 1m to do the compilation, running, etc. Having a history buffer would be nice too and even a debugger showing the basic state(nothing fancy). Anything like this out there. Lua has things like this that are very nice to do because they allow for quick testing and prototyping.
Jun 16 2017
On Friday, 16 June 2017 at 07:57:46 UTC, Mike B Johnson wrote:I am developing a D app and I have a need to test things out. I do not want to have to recompile the app every time I want to test some functionality out. [...]There is drepl, it's not fancy, but works for basic use cases... https://github.com/drepl/drepl
Jun 16 2017
On Friday, 16 June 2017 at 18:13:33 UTC, Seb wrote:On Friday, 16 June 2017 at 07:57:46 UTC, Mike B Johnson wrote:But that doesn't interface with ones own program? I'm not talking about a standalone repl but something what can use from their own program and then use that command line interface of it(or just send command through text) and interact with the original program: string foo() { writeln("foo"); } void main() { repl.init(); writeln(repl.exec("foo()")); writeln(repl.exec(readline())); repl.OpenInterface(); // <- A new command window is open that lets us run code from it, code that has access to this programs code. } Or whatever.I am developing a D app and I have a need to test things out. I do not want to have to recompile the app every time I want to test some functionality out. [...]There is drepl, it's not fancy, but works for basic use cases... https://github.com/drepl/drepl
Jun 16 2017
On Friday, 16 June 2017 at 07:57:46 UTC, Mike B Johnson wrote:I am developing a D app and I have a need to test things out. I do not want to have to recompile the app every time I want to test some functionality out. Suppose I have an app with some functions like foo, bar, etc... in some module m. I would like to be able to do basic stuff likePlease check out: https://github.com/DlangScience/PydMagic/blob/master/README.md I haven't used it myself, but fits right in the Jupyter/IPython ecosystem. -- Sameer[...]or[...]etc... This way I can write the functions, compile, then test them out without compiling. e.g.,[...]which turns on the 34th light in the house, then[...]which turns it off. This should take about 1-2 seconds to test RATHER than about 1m to do the compilation, running, etc. Having a history buffer would be nice too and even a debugger showing the basic state(nothing fancy). Anything like this out there. Lua has things like this that are very nice to do because they allow for quick testing and prototyping.
Jun 16 2017
On Friday, 16 June 2017 at 18:43:24 UTC, Sameer Pradhan wrote:On Friday, 16 June 2017 at 07:57:46 UTC, Mike B Johnson wrote:Thanks, not sure if this will work and I don't like python much, but I'll give a look at some point and see. Maybe it can be integrated back in to a D program and then work out well: D->python->D.[...]Please check out: https://github.com/DlangScience/PydMagic/blob/master/README.md I haven't used it myself, but fits right in the Jupyter/IPython ecosystem. -- Sameer
Jun 16 2017