Re: repl like interface with D app

2017-06-16 Thread Mike B Johnson via Digitalmars-d-learn

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:
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



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.


Re: repl like interface with D app

2017-06-16 Thread Mike B Johnson via Digitalmars-d-learn

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:

[...]




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


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.


Re: repl like interface with D app

2017-06-16 Thread Sameer Pradhan via Digitalmars-d-learn

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 like


[...]


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.




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


Re: repl like interface with D app

2017-06-16 Thread Seb via Digitalmars-d-learn

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


repl like interface with D app

2017-06-16 Thread Mike B Johnson via Digitalmars-d-learn
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 like


writeln(m.foo());


or


auto 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, then


m.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.