Re: early alpha of D REPL

2014-02-21 Thread Martin Nowak

On 02/14/2014 03:33 PM, Tourist wrote:




Looks like you're being sarcastic.
What I meant is that sending comments twice disconnects the server. I
can reproduce it every time. Looks like a bug to me.


Please file bug reports.
https://github.com/MartinNowak/drepl/issues

https://github.com/MartinNowak/drepl/commit/7ec687ba342a04bff040630957bb10876d0ebb78
https://github.com/MartinNowak/drepl/commit/3eb953e91b29546a89c222cb4f9e8b9341dc1a47


Re: early alpha of D REPL

2014-02-17 Thread Rory McGuire
hehe, sorry. I use GMail and your comment was the last comment so I ended
up commenting on your comment instead of the announcement.


On Fri, Feb 14, 2014 at 4:33 PM, Tourist grava...@gravatar.com wrote:


 Looks like you're being sarcastic.
 What I meant is that sending comments twice disconnects the server. I can
 reproduce it every time. Looks like a bug to me.

I too could reproduce that bug.


Re: early alpha of D REPL

2014-02-16 Thread Martin Nowak

On 02/14/2014 03:33 PM, Tourist wrote:

I can reproduce it every time. Looks like a bug to me.


How about reporting a bug?
https://github.com/MartinNowak/drepl/issues


Re: early alpha of D REPL

2014-02-16 Thread Martin Nowak

On 02/15/2014 12:29 AM, cal wrote:

My target was windows initially, where I guess this won't work
currently. Hopefully the situation there will improve soon.


Yes, we'll improve the Windows DLL support.
At some point shared libraries should work equally well on all platforms.

I also had a skype call with Benjamin about DIP45 yesterday.
http://wiki.dlang.org/DIP45


Re: early alpha of D REPL

2014-02-14 Thread John Colvin

On Friday, 14 February 2014 at 05:32:12 UTC, Asman01 wrote:
On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak 
wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
| return t.name;
| }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


Very nice! thanks. I tried the following code but it print 
nothing:


auto twice = (int a) = 2*a;
twice(2);

What's wrong with that?


Drop the semicolon after twice(2)


Re: early alpha of D REPL

2014-02-14 Thread Martin Nowak

On Friday, 14 February 2014 at 11:58:43 UTC, John Colvin wrote:

auto twice = (int a) = 2*a;
twice(2);

What's wrong with that?


Drop the semicolon after twice(2)


Yeah, with a semicolon it's a statement, so it doesn't have any 
result value to print.

Without the semicolon it's an expression.


Re: early alpha of D REPL

2014-02-14 Thread cal

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


This approach with separate modules is far superior to what I did 
with dabble, and much simpler. My target was windows initially, 
where I guess this won't work currently. Hopefully the situation 
there will improve soon.


Re: early alpha of D REPL

2014-02-13 Thread Tourist

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


http://i.imgur.com/LNYMNYw.png


Re: early alpha of D REPL

2014-02-13 Thread Rory McGuire
very cool


On Thu, Feb 13, 2014 at 12:27 PM, Tourist grava...@gravatar.com wrote:

 On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

 Barely running but already fun and a little useful.

 Example:

 D import std.algorithm, std.array, std.file;
 = std
 D auto name(T)(T t) {
  | return t.name;
  | }
 = name
 D dirEntries(., SpanMode.depth).map!name.join(, )
 = ./drepl_sandbox
 D

 https://github.com/MartinNowak/drepl
 http://drepl.dawg.eu/


 http://i.imgur.com/LNYMNYw.png



Re: early alpha of D REPL

2014-02-13 Thread Asman01

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


Very nice! thanks. I tried the following code but it print 
nothing:


auto twice = (int a) = 2*a;
twice(2);

What's wrong with that?


Re: early alpha of D REPL

2014-02-12 Thread thedeemon

On Wednesday, 12 February 2014 at 04:43:00 UTC, cal wrote:

On Tuesday, 11 February 2014 at 11:33:53 UTC, thedeemon wrote:

Have you seen Dabble?
https://github.com/callumenator/dabble


Just found out its author added Linux support. I was able to 
build an x86 version but it didn't work properly in a 64 bit 
system: it assumes dmd makes x86 binaries by default while it 
really makes 64-bit ones.


I don't have a 64-bit tool-chain to play with, could submit 
those 64 bit build errors on github?


I've just submitted a pull request for compiling dabble repl in 
64 bits and created an issue on github with the linking problem 
arising when it tries to work. My diagnosis of the problem might 
be absolutely wrong though.


Re: early alpha of D REPL

2014-02-12 Thread Sönke Ludwig

Am 12.02.2014 03:49, schrieb Martin Nowak:

On 02/11/2014 04:24 PM, Martin Nowak wrote:




No problem :), it's the most important TODO right now to prevent this.
https://github.com/MartinNowak/drepl/blob/master/examples/server.d#L34


I wish SELinux was simpler, but it isn't. So instead of using a TCP
socket, I quickfixed this issue by polling non-blocking process pipes
https://github.com/MartinNowak/drepl/commit/1aef9acedb4ee4ee7cdcceda56796aba6d460cbe.



BTW, if you (can) use the latest vibe.d beta version, there is also the 
vibe.core.core.createFileDescriptorEvent function, which should work for 
waiting on the non-blocking pipes instead of busy-waiting with yield().


Re: early alpha of D REPL

2014-02-12 Thread Martin Nowak

On 02/12/2014 10:29 AM, Sönke Ludwig wrote:


BTW, if you (can) use the latest vibe.d beta version, there is also the
vibe.core.core.createFileDescriptorEvent function, which should work for
waiting on the non-blocking pipes instead of busy-waiting with yield().


Nice, will try.


Re: early alpha of D REPL

2014-02-12 Thread Martin Nowak

On 02/11/2014 11:32 AM, thedeemon wrote:




Have you seen Dabble?
https://github.com/callumenator/dabble
It works pretty well on my Win 7.


I will try it again, there is a lot of recent activity.
Last time it didn't work.
https://github.com/callumenator/dabble/issues/1
I think it still misses an essential part.
To make a real REPL one has to support importing of modules and linking,
otherwise one can only imitate certain language constructs.
For example it should be possible to call a function or inherit from a 
class that were defined earlier.






Re: early alpha of D REPL

2014-02-12 Thread MattCoder

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.


Interesting!

I was playing around:

D write(test);
= undefined identifier write
D import std.stdio;
= std
D write(test);
D

Shouldn't code above print test?


Re: early alpha of D REPL

2014-02-12 Thread Brad Anderson

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


I'm kind of amazed how well this works. Awesome.


Re: early alpha of D REPL

2014-02-12 Thread Timothee Cour
already added a bug report in github for that


On Wed, Feb 12, 2014 at 11:56 AM, MattCoder
somekindofmons...@email.com.brwrote:

 On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

 Barely running but already fun and a little useful.


 Interesting!

 I was playing around:

 D write(test);
 = undefined identifier write
 D import std.stdio;
 = std
 D write(test);
 D

 Shouldn't code above print test?



Re: early alpha of D REPL

2014-02-12 Thread MattCoder

On Wednesday, 12 February 2014 at 21:07:27 UTC, Timothee Cour
wrote:

already added a bug report in github for that


Hmmm I should have checked the issue list first!

Thanks for the info,

Matheus.


Re: early alpha of D REPL

2014-02-12 Thread Kelet

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


Excellent, I've been waiting for this. Even better than I 
expected as it has a nice web interface. All of my initial bugs 
have already been reported.


Once this project (or perhaps dabble) is more mature, something 
like http://tryhaskell.org/ or http://tryruby.org/ may be a good 
idea.


Re: early alpha of D REPL

2014-02-11 Thread deadalnix

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


As I understand it, you are executing dmd in the background to 
repl. Simple and clever :D


Re: early alpha of D REPL

2014-02-11 Thread extrawurst

On Tuesday, 11 February 2014 at 08:15:55 UTC, Martin Nowak wrote:
On Tuesday, 11 February 2014 at 05:37:45 UTC, Andrei 
Alexandrescu wrote:


As I understand it, you are executing dmd in the background 
to repl.

Simple and clever :D


But then how is it saving context?

Andrie


It's using shared libraries to do so. Each new deck/stmt/expr 
is compiled in a shared library. This library imports and links 
against all previous libraries to make the context available.
I still need to implement a few rewrites, i.e. `auto var = 
val;` should become `typeof(val) var; shared static this() { 
var = val; }` too support runtime initialization.


Thats a nifty trick!


Re: early alpha of D REPL

2014-02-11 Thread extrawurst

On Tuesday, 11 February 2014 at 08:49:56 UTC, extrawurst wrote:
On Tuesday, 11 February 2014 at 08:15:55 UTC, Martin Nowak 
wrote:
On Tuesday, 11 February 2014 at 05:37:45 UTC, Andrei 
Alexandrescu wrote:


As I understand it, you are executing dmd in the background 
to repl.

Simple and clever :D


But then how is it saving context?

Andrie


It's using shared libraries to do so. Each new deck/stmt/expr 
is compiled in a shared library. This library imports and 
links against all previous libraries to make the context 
available.
I still need to implement a few rewrites, i.e. `auto var = 
val;` should become `typeof(val) var; shared static this() { 
var = val; }` too support runtime initialization.


Thats a nifty trick!



Did I just kill it ?
After playing around the site is not responding anymore :( I am 
sorry


Re: early alpha of D REPL

2014-02-11 Thread Andrei Alexandrescu

On 2/10/14, 9:01 PM, deadalnix wrote:

On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
 | return t.name;
 | }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


As I understand it, you are executing dmd in the background to repl.
Simple and clever :D


But then how is it saving context?

Andrie


Re: early alpha of D REPL

2014-02-11 Thread Martin Nowak
On Tuesday, 11 February 2014 at 05:37:45 UTC, Andrei Alexandrescu 
wrote:


As I understand it, you are executing dmd in the background to 
repl.

Simple and clever :D


But then how is it saving context?

Andrie


It's using shared libraries to do so. Each new deck/stmt/expr is 
compiled in a shared library. This library imports and links 
against all previous libraries to make the context available.
I still need to implement a few rewrites, i.e. `auto var = val;` 
should become `typeof(val) var; shared static this() { var = val; 
}` too support runtime initialization.


Re: early alpha of D REPL

2014-02-11 Thread thedeemon



Have you seen Dabble?
https://github.com/callumenator/dabble


Just found out its author added Linux support. I was able to 
build an x86 version but it didn't work properly in a 64 bit 
system: it assumes dmd makes x86 binaries by default while it 
really makes 64-bit ones. And for 64 bits Dabble doesn't compile: 
as it often happens, it's too easy to forget that array.length is 
not always uint.


Re: early alpha of D REPL

2014-02-11 Thread deadalnix

On Tuesday, 11 February 2014 at 13:11:06 UTC, The Guest wrote:
On Tuesday, 11 February 2014 at 04:46:41 UTC, Martin Nowak 
wrote:

Barely running but already fun and a little useful.

Example:

D import std.algorithm, std.array, std.file;
= std
D auto name(T)(T t) {
| return t.name;
| }
= name
D dirEntries(., SpanMode.depth).map!name.join(, )
= ./drepl_sandbox
D

https://github.com/MartinNowak/drepl
http://drepl.dawg.eu/


http://dpaste.dzfl.pl/1969487a
Works for me when playing around.
Not sure we'll ever see a real D repl.


SDC is capable to JIT whatever D it support. That mean you can
create a REPL fairly easily. This has been in my TODO list for a
while, but supporting more feature is higher priority.

Feel free to contact me is that is of interest for you (Martin,
please do as well if you think it is worth it).


Re: early alpha of D REPL

2014-02-11 Thread Martin Nowak

On 02/11/2014 04:24 PM, Martin Nowak wrote:




No problem :), it's the most important TODO right now to prevent this.
https://github.com/MartinNowak/drepl/blob/master/examples/server.d#L34


I wish SELinux was simpler, but it isn't. So instead of using a TCP 
socket, I quickfixed this issue by polling non-blocking process pipes 
https://github.com/MartinNowak/drepl/commit/1aef9acedb4ee4ee7cdcceda56796aba6d460cbe.


Re: early alpha of D REPL

2014-02-11 Thread cal

On Tuesday, 11 February 2014 at 11:33:53 UTC, thedeemon wrote:



Have you seen Dabble?
https://github.com/callumenator/dabble


Just found out its author added Linux support. I was able to 
build an x86 version but it didn't work properly in a 64 bit 
system: it assumes dmd makes x86 binaries by default while it 
really makes 64-bit ones. And for 64 bits Dabble doesn't 
compile: as it often happens, it's too easy to forget that 
array.length is not always uint.


I don't have a 64-bit tool-chain to play with, could submit those 
64 bit build errors on github?