www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - repls for d

reply monkyyy <crazymonkyyy gmail.com> writes:
So I like repl programming, Im aware of dlang.io and the project 
on dub; I ussally use dlang.io despite the blind theme, it often 
being out of date, and slow. But today I needed it to be in the 
terminal, so I made an another terrible solution

https://gist.github.com/crazymonkyyy/bd90fe3e7a9372cbe5c644cce11c1b9e

Its an ed like line editer... so terrible, truely awful. Maybe 
someone else cares tho.

Are there other solutions or some travail improvement?
Oct 31
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Thursday, 31 October 2024 at 21:48:24 UTC, monkyyy wrote:
 So I like repl programming, Im aware of dlang.io and the 
 project on dub; I ussally use dlang.io despite the blind theme, 
 it often being out of date, and slow. But today I needed it to 
 be in the terminal, so I made an another terrible solution

 https://gist.github.com/crazymonkyyy/bd90fe3e7a9372cbe5c644cce11c1b9e

 Its an ed like line editer... so terrible, truely awful. Maybe 
 someone else cares tho.

 Are there other solutions or some travail improvement?
yeah you can build shared libraries and use them to load new versions of the code dynamically. There is a drepl project which used this IIRC. However maybe it won't compile anymore?
Oct 31
parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Thursday, 31 October 2024 at 22:16:03 UTC, Stefan Koch wrote:
 On Thursday, 31 October 2024 at 21:48:24 UTC, monkyyy wrote:
 So I like repl programming, Im aware of dlang.io and the 
 project on dub; I ussally use dlang.io despite the blind 
 theme, it often being out of date, and slow. But today I 
 needed it to be in the terminal, so I made an another terrible 
 solution

 https://gist.github.com/crazymonkyyy/bd90fe3e7a9372cbe5c644cce11c1b9e

 Its an ed like line editer... so terrible, truely awful. Maybe 
 someone else cares tho.

 Are there other solutions or some travail improvement?
yeah you can build shared libraries and use them to load new versions of the code dynamically. There is a drepl project which used this IIRC. However maybe it won't compile anymore?
adr also suggested dll hacks, and I still dont understand it d compiler is fast enough that you can just copy a 100 lines in and out of memory and have it compile effectly instantly; if it didnt Id be blaming the std before the code the copyed such a comparably small string
Oct 31
parent reply Lance Bachmeier <no spam.net> writes:
On Thursday, 31 October 2024 at 23:41:47 UTC, monkyyy wrote:

 adr also suggested dll hacks, and I still dont understand it
 d compiler is fast enough that you can just copy a 100 lines in 
 and out of memory and have it compile effectly instantly; if it 
 didnt Id be blaming the std before the code the copyed such a 
 comparably small string
This is the drepl project: https://github.com/dlang-community/drepl The way I've always written my programs is to make a few changes, recompile with DMD, and fix anything that needs fixing. This works just fine even for projects with tens of thousands of lines of code as long as you avoid anything but the simplest templates.
Oct 31
parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Friday, 1 November 2024 at 01:03:44 UTC, Lance Bachmeier wrote:
 This is the drepl project: 
 https://github.com/dlang-community/drepl
I dont think its been compiling for a while, and I didnt care much when it was
Oct 31
parent reply =?UTF-8?B?UsOpbXkgTW91w6t6YQ==?= <remy.moueza g.m.a.il.com> writes:
On Friday, 1 November 2024 at 01:52:54 UTC, monkyyy wrote:
 On Friday, 1 November 2024 at 01:03:44 UTC, Lance Bachmeier 
 wrote:
 This is the drepl project: 
 https://github.com/dlang-community/drepl
I dont think its been compiling for a while, and I didnt care much when it was
I had some issues with the linenoise dependency `preBuildCommands` script, around a year ago. The fix was to use the `$LINENOISE_PACKAGE_DIR` variable instead of `$PACKAGE_DIR` to build drepl. from: ``` "cd $PACKAGE_DIR; [ -f C/linenoise.o ] || cc -c -fPIC -o C/linenoise.o C/linenoise.c" platform="posix" ``` to: ``` "cd $LINENOISE_PACKAGE_DIR; [ -f C/linenoise.o ] || cc -c -fPIC -o C/linenoise.o C/linenoise.c" platform="posix" ``` I changed it directly in the `~/.dub/packages/linenoise/1.1.0+1.0.0/linenoise/dub.json`. The parsing being done by an older libdparse library, short function forms like `int addOne(int i) => i + 1;` or named function argument are not available.
Nov 01
parent reply jmh530 <john.michael.hall gmail.com> writes:
On Friday, 1 November 2024 at 22:48:25 UTC, Rémy Mouëza wrote:
 On Friday, 1 November 2024 at 01:52:54 UTC, monkyyy wrote:
 [...]
I had some issues with the linenoise dependency `preBuildCommands` script, around a year ago. The fix was to use the `$LINENOISE_PACKAGE_DIR` variable instead of `$PACKAGE_DIR` to build drepl. from: ``` "cd $PACKAGE_DIR; [ -f C/linenoise.o ] || cc -c -fPIC -o C/linenoise.o C/linenoise.c" platform="posix" ``` to: ``` "cd $LINENOISE_PACKAGE_DIR; [ -f C/linenoise.o ] || cc -c -fPIC -o C/linenoise.o C/linenoise.c" platform="posix" ``` I changed it directly in the `~/.dub/packages/linenoise/1.1.0+1.0.0/linenoise/dub.json`. The parsing being done by an older libdparse library, short function forms like `int addOne(int i) => i + 1;` or named function argument are not available.
Would you be able to submit the fix?
Nov 01
parent reply =?UTF-8?B?UsOpbXkgTW91w6t6YQ==?= <remy.moueza gmail.com> writes:
On Friday, 1 November 2024 at 23:48:10 UTC, jmh530 wrote:
 Would you be able to submit the fix?
Someone already did it. It's not been merged yet: https://github.com/MartinNowak/linenoise/pull/1/files
Nov 04
parent reply jmh530 <john.michael.hall gmail.com> writes:
On Monday, 4 November 2024 at 19:27:34 UTC, Rémy Mouëza wrote:
 On Friday, 1 November 2024 at 23:48:10 UTC, jmh530 wrote:
 Would you be able to submit the fix?
Someone already did it. It's not been merged yet: https://github.com/MartinNowak/linenoise/pull/1/files
Thanks. Only over a year old...
Nov 04
parent monkyyy <crazymonkyyy gmail.com> writes:
On Monday, 4 November 2024 at 19:46:59 UTC, jmh530 wrote:
 On Monday, 4 November 2024 at 19:27:34 UTC, Rémy Mouëza wrote:
 On Friday, 1 November 2024 at 23:48:10 UTC, jmh530 wrote:
 Would you be able to submit the fix?
Someone already did it. It's not been merged yet: https://github.com/MartinNowak/linenoise/pull/1/files
Thanks. Only over a year old...
I dont remeber why I dont care about drepl much, but isnt it overcomplex for what you need? Repl-ish tools shouldnt need to parse d, just that the text editor to compiler maybe more then 1 key press before giving you results, the compiler for sub lets say 500 lines files should be a key press compile time.
Nov 04