Thread overview
Does D supports REPL
May 24, 2016
Tanmoy Kar
May 24, 2016
cym13
May 24, 2016
Seb
May 24, 2016
jmh530
May 25, 2016
Seb
May 25, 2016
Carl
May 25, 2016
jmh530
May 25, 2016
Carl Vogel
May 25, 2016
Carl Vogel
May 25, 2016
Seb
May 24, 2016
Hi,

I came to know D today while surfing for next would be popular language.

I did not go the forums, still just wanted to know whether D supports REPL (Read-Eval-Print Loop), like scala. where we can do a quick check of the small code on the fly ( without going through the full cycle of compile - linking ....,  for a quick test).

Nice to see that it's D.   C , C++ and now one step ahead the brand new D.


Thanks
Tanmoy
May 24, 2016
On Tuesday, 24 May 2016 at 19:38:50 UTC, Tanmoy Kar wrote:
> Hi,
>
> I came to know D today while surfing for next would be popular language.
>
> I did not go the forums, still just wanted to know whether D supports REPL (Read-Eval-Print Loop), like scala. where we can do a quick check of the small code on the fly ( without going through the full cycle of compile - linking ....,  for a quick test).
>
> Nice to see that it's D.   C , C++ and now one step ahead the brand new D.
>
>
> Thanks
> Tanmoy

This works https://github.com/MartinNowak/drepl although it's quite quirky. Fore some reasons REPLs haven't been part of the D philosophy in the past, I don't think it will be in the near future.
May 24, 2016
On Tuesday, 24 May 2016 at 19:43:07 UTC, cym13 wrote:
> On Tuesday, 24 May 2016 at 19:38:50 UTC, Tanmoy Kar wrote:
>> Hi,
>>
>> I came to know D today while surfing for next would be popular language.
>>
>> I did not go the forums, still just wanted to know whether D supports REPL (Read-Eval-Print Loop), like scala. where we can do a quick check of the small code on the fly ( without going through the full cycle of compile - linking ....,  for a quick test).
>>
>> Nice to see that it's D.   C , C++ and now one step ahead the brand new D.
>>
>>
>> Thanks
>> Tanmoy
>
> This works https://github.com/MartinNowak/drepl although it's quite quirky. Fore some reasons REPLs haven't been part of the D philosophy in the past, I don't think it will be in the near future.

There is also dabble (https://github.com/callumenator/dabble), but it seems to be broken.

Btw I do think it's part of the D philosophy (run fast simple examples), but I guess it's just not top priority at the moment.
Martin's drepl had approval btw, see e.g. https://twitter.com/d_programming/status/433715152655884288

Maybe we just need to move it to the dlang github namespace, s.t. it gets properly maintained and maybe even released with dmd/dub?
May 24, 2016
On Tuesday, 24 May 2016 at 20:44:57 UTC, Seb wrote:
> Maybe we just need to move it to the dlang github namespace, s.t. it gets properly maintained and maybe even released with dmd/dub?

Integration with Jupyter would be cool as well, but I have basically no idea how to accomplish that.
May 25, 2016
On Tuesday, 24 May 2016 at 23:26:27 UTC, jmh530 wrote:
> On Tuesday, 24 May 2016 at 20:44:57 UTC, Seb wrote:
>> Maybe we just need to move it to the dlang github namespace, s.t. it gets properly maintained and maybe even released with dmd/dub?
>
> Integration with Jupyter would be cool as well, but I have basically no idea how to accomplish that.


Yep I would love to have a D Jupyter kernel - there is already PydMagic [1], which looks great (I haven't tried it yet), but all those other languages (C, C++, Scala, Java, Tcl, Brainfuck, Clojure, Ocaml, Erlang, Go, FSharp, Haskell and on the dynamic end: Python, JavaScript, CoffeeScript, Ruby, PHP, Perl, Octave, Bash, PowerShell, Lua, Julia, Prolog, J, etc.) [2] managed to get a working Jupyter kernel, so why don't we :O
I opened an issue at d-repl [3], maybe that's a good place to start a focussed discussion.

[1] https://github.com/DlangScience/PydMagic
[2] https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages
[3] https://github.com/MartinNowak/drepl/issues/37
May 25, 2016
On Wednesday, 25 May 2016 at 00:12:24 UTC, Seb wrote:
> On Tuesday, 24 May 2016 at 23:26:27 UTC, jmh530 wrote:
>> On Tuesday, 24 May 2016 at 20:44:57 UTC, Seb wrote:
>>> Maybe we just need to move it to the dlang github namespace, s.t. it gets properly maintained and maybe even released with dmd/dub?
>>
>> Integration with Jupyter would be cool as well, but I have basically no idea how to accomplish that.
>
>
> Yep I would love to have a D Jupyter kernel - there is already PydMagic [1], which looks great (I haven't tried it yet), but all those other languages (C, C++, Scala, Java, Tcl, Brainfuck, Clojure, Ocaml, Erlang, Go, FSharp, Haskell and on the dynamic end: Python, JavaScript, CoffeeScript, Ruby, PHP, Perl, Octave, Bash, PowerShell, Lua, Julia, Prolog, J, etc.) [2] managed to get a working Jupyter kernel, so why don't we :O
> I opened an issue at d-repl [3], maybe that's a good place to start a focussed discussion.
>
> [1] https://github.com/DlangScience/PydMagic
> [2] https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages
> [3] https://github.com/MartinNowak/drepl/issues/37

It's worth noting that some of those Jupyter kernels are pretty quirky/limited. For example in the C kernel, every cell is an isolated program with a main function.

Which is not to say it wouldn't be great to have D integration, just that it's trickier than it may seem at first glance.

May 25, 2016
On Wednesday, 25 May 2016 at 00:12:24 UTC, Seb wrote:
> On Tuesday, 24 May 2016 at 23:26:27 UTC, jmh530 wrote:
>> On Tuesday, 24 May 2016 at 20:44:57 UTC, Seb wrote:
>>> Maybe we just need to move it to the dlang github namespace, s.t. it gets properly maintained and maybe even released with dmd/dub?
>>
>> Integration with Jupyter would be cool as well, but I have basically no idea how to accomplish that.
>
>
> Yep I would love to have a D Jupyter kernel - there is already PydMagic [1], which looks great (I haven't tried it yet), but all those other languages (C, C++, Scala, Java, Tcl, Brainfuck, Clojure, Ocaml, Erlang, Go, FSharp, Haskell and on the dynamic end: Python, JavaScript, CoffeeScript, Ruby, PHP, Perl, Octave, Bash, PowerShell, Lua, Julia, Prolog, J, etc.) [2] managed to get a working Jupyter kernel, so why don't we :O
> I opened an issue at d-repl [3], maybe that's a good place to start a focussed discussion.
>
> [1] https://github.com/DlangScience/PydMagic
> [2] https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages
> [3] https://github.com/MartinNowak/drepl/issues/37

It seems to me that both drepl and dabble are unsupported. It's not clear to me which one at this point is a better basis for a stable repl (I kind of prefer drepl, since the code is clearer to me, and I can mostly compile it.) If you're really interested in a good REPL for D--which I agree would be a great gain--and want to fork either of these, I'd be very interested in this effort and happy to contribute (otherwise I may start going at it on my own). It really is something I'd use a lot if it existed.
May 25, 2016
On Wednesday, 25 May 2016 at 00:55:52 UTC, Carl wrote:
>
> It's worth noting that some of those Jupyter kernels are pretty quirky/limited. For example in the C kernel, every cell is an isolated program with a main function.
>
> Which is not to say it wouldn't be great to have D integration, just that it's trickier than it may seem at first glance.

I haven't used the C one. It looks like it is based on GCC. Cling is another one listed for C++. I haven't used Cling, but the example looks like the information in one cell can be used in later cells:
https://github.com/root-mirror/cling/blob/master/tools/Jupyter/kernel/cling.ipynb

There seems to be some decent documentation on creating kernels:
http://jupyter-client.readthedocs.io/en/latest/kernels.html
May 25, 2016
On Wednesday, 25 May 2016 at 19:38:42 UTC, jmh530 wrote:
> On Wednesday, 25 May 2016 at 00:55:52 UTC, Carl wrote:
>>
>> It's worth noting that some of those Jupyter kernels are pretty quirky/limited. For example in the C kernel, every cell is an isolated program with a main function.
>>
>> Which is not to say it wouldn't be great to have D integration, just that it's trickier than it may seem at first glance.
>
> I haven't used the C one. It looks like it is based on GCC. Cling is another one listed for C++. I haven't used Cling, but the example looks like the information in one cell can be used in later cells:
> https://github.com/root-mirror/cling/blob/master/tools/Jupyter/kernel/cling.ipynb
>
> There seems to be some decent documentation on creating kernels:
> http://jupyter-client.readthedocs.io/en/latest/kernels.html

Yeah, I haven't tried the cling kernel yet, but it looks great. That's backed by an actual repl though. So it seems like that's a prerequisite for having a good Jupyter integration.

This is a nice intro to the Jupyter architecture from the person who made the IHaskell kernel:  https://www.schoolofhaskell.com/school/to-infinity-and-beyond/older-but-still-interesting/ihaskell
May 25, 2016
On Wednesday, 25 May 2016 at 18:03:49 UTC, Carl Vogel wrote:
> It seems to me that both drepl and dabble are unsupported. It's not clear to me which one at this point is a better basis for a stable repl (I kind of prefer drepl, since the code is clearer to me, and I can mostly compile it.) If you're really interested in a good REPL for D--which I agree would be a great gain--and want to fork either of these, I'd be very interested in this effort and happy to contribute (otherwise I may start going at it on my own). It really is something I'd use a lot if it existed.

As we are about to reboot this project, I created a drepl project on Github on which we can work and discuss ideas:

https://github.com/drepl/drepl/issues/1

Hopefully we can push this forward and achieve a real Jupyter kernel for D :)