4 ms·
When I first started using Nim I felt the same way. While I still would love a REPL in Nim, I think you can get pretty close to one by just getting an IDE that
by dom96 10y ago
When I first started using Nim I felt the same way. While I still would love a REPL in Nim, I think you can get pretty close to one by just getting an IDE that can compile snippets of source code for you quickly and easily.
- cjhanks 10y agoWhich IDE?
- dom96 10y agoA text editor[1] I wrote a while ago has a feature that allows you to compile and run any tab by pressing F5, even when that tab is not saved anywhere it will save it to /tmp and compile it for you. It's a very simple feature that I'm sure can be implemented as a plugin in any IDE/Text editor. The Nim VS Code plugin sort of supports it, but the feature could be improved. (Nowadays, I wouldn't recommend using Aporia for various reasons). 1 - Aporia - https://github.com/nim-lang/Aporia https://github.com/nim-lang/Aporia
- kaushalmodi 10y ago> Nowadays, I wouldn't recommend using Aporia for various reasons On https://nim-lang.org/faq.html https://nim-lang.org/faq.html under "What about editor support?", Aporia is mentioned as the first option. Should it be moved lower in the list? Anyways I use nim-mode in emacs, and it works great!
- FridgeSeal 10y agoI've had success with vscode: I have it setup to build+run on save which has so far netted me very quick turnaround times for trying things out. Admittedly I'm still doing super basic stuff at the moment.
- partisan 10y agoSame here. It is a good combination and creating a build task for nim is super simple.
- deleted 10y ago[deleted]
- the_duke 10y agoI'm not sure this still works, but I wrote a nim playground a while ago that you can just run locally. (Similar to http://play.rust-lang.org http://play.rust-lang.org or https://play.go-lang.org https://play.go-lang.org). https://github.com/theduke/nim-playground https://github.com/theduke/nim-playground
- kaushalmodi 10y agoEmacs. I have the nim-mode and smart-compile packages installed, and I have bound F9 to compile the nim code in the current buffer, and run it in the emacs-inbuilt eshell. I have configured so that the point and buffer switching 'does the right thing'. - If the compilation fails, show the compilation buffer in the other window, and do not execute the binary, and keep the point in the code window. - If the compilation passes, execute the binary in the other window. - Now if the binary execution ends with showing the eshell prompt, move the point back to the other window (code window). - If not, that is, if the eshell prompt does not show up, keep the point in the eshell buffer, because that most likely means that some user input is expected. --- So my nim learning process goes as: type a code snippet, F9, type more, probably cause error, F9, fix that, F9, etc. Config: [1] [2] [1]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-compile.el https://github.com/kaushalmodi/.emacs.d/blob/master/setup-fi... [2]: https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-nim.el https://github.com/kaushalmodi/.emacs.d/blob/master/setup-fi...
- alphapapa 10y agoHey, fancy meeting you here. :) Thanks for sharing that, I'll have to give it a try.
- kevin_thibedeau 10y agoWith TinyCC Nim can compile fast enough to serve as a simple REPL[1]. It's already packaged for consumption: https://github.com/wheineman/nrpl https://github.com/wheineman/nrpl [1] https://hookrace.net/blog/what-makes-nim-practical/#use-as-a-scripting-language https://hookrace.net/blog/what-makes-nim-practical/#use-as-a...
- IronBacon 10y agoWhen I can't have a working REPL I use inotify or entr (entrproject.org) to compile and run the program I'm editing when saving. It's not the same thing but it spares a few key strokes...