9 ms·
Nim programming language
- cjhanks 9y agoNim is the language I have always thought was a brilliant idea that I never get to use. It's a shame. Nim is to C/C++ as CoffeeScript is to JavaScript. A highly extensible template language atop a portable language with libraries for practically everything. So why haven't I hopped on the bandwagon? Outside of C++, C, and Fortran - the only way I have ever learned a new language is through using a REPL. How much of Python's and MATLAB's (and maybe even Julia's) success is due to having a brilliant REPL? I am not complaining, and I do not have any free time to fix it. But man... if Nim just had a killer REPL that allowed me to slowly learn the language properly while not being blocked from my daily work... it would be just killer!
- Cyph0n 9y agoScala has an excellent REPL too. I often use it to test Java libraries without having to setup a full project. There is also the excellent 3rd-party REPL called Ammonite[1], which is maintained by Li Haoyi[2]. Not only is it a REPL, but it also provides a full-blown scripting interface in Scala! [1]: http://www.lihaoyi.com/Ammonite/#Ammonite-REPL http://www.lihaoyi.com/Ammonite/#Ammonite-REPL [2]: https://github.com/lihaoyi https://github.com/lihaoyi
- dom96 9y agoWhen 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 9y agoWhich IDE?
- dom96 9y 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 9y 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 9y 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 9y agoSame here. It is a good combination and creating a build task for nim is super simple.
- deleted 9y ago[deleted]
- the_duke 9y 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
- kevin_thibedeau 9y 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 9y 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...
- throwaway7645 9y agoI felt the same way. I am still learning it, but not as fast as I could with a REPL. Transpiling to C to get the optimizations in GCC is awesome.
- blt 9y agoWhat makes a REPL brilliant instead of average?
- yjgyhj 9y agoThat the repl is in your editor, and you can hit ctrl-c ctrl-e to evaluate anything on the fly.
- jernfrost 9y agoI love the REPL in the Julia programming language. What makes me love it is combination of many small things which makes it practical: (1) remember past written statements (2) completes both functions/types/variables and previously written statements (3) Whenever you write strings you get directory and file name completions. This is amazingly handy when doing some kind of scripting job. (4) The ability to jump into shell mode and help mode by just writing a single character. (5) The integration between the Julia REPL and Unix shell. When in shell mode my Julia variables are accessible as normal shell variables. It is really the combination of all these things which makes it feel very productive to work with.
- gigatexal 9y ago+1 to the usefulness of a REPL. Anyone know of a good one for the vanilla Java language?
- moomin 9y agoI don't, but I'll point out you can do a lot of exploration in the Clojure repl, and with leiningen it's really easy to set up anything in maven.
- gigatexal 9y agoI must have a really low I.Q. Or something because maven is all but broken in intellij for me. The Apache quickstart template defaults to jdk 5?!? And the pom file seems like it could get out of control fast.
- moomin 9y agoSorry, by "in maven" I meant "in a maven repository". Using Maven itself is a nightmare, I know, but if what you need is to download some jars and stick them on the classpath, leiningen is perfect (it even compiles regular Java and has control over JDK versions if you want that) And it generates the pom files so you don't have to...
- nonsince 9y agoIf you could do Clojure-style repl-driven development and hot code reloading with the libraries of C++ and the syntax of Python I would be using Nim for everything already
- pagnol 9y agoI recently had to learn a language whose REPL I didn't like and initially felt the same way, but then I did the following: I began writing 'unit tests' for each feature of the language I studied, and I had a Makefile to recompile and run my tests whenever I saved. This setup gives you instant feedback just like a REPL with the added convenience of being able to go back to previous examples without having to separately store your history. Depending on the testing library, you also get a detailed explanation of what's wrong. Now, when using the language, I still return to my 'tests' every once in a while for reference. In the Makefile itself I use entr: http://entrproject.org/ http://entrproject.org/
- noir_lord 9y agoYou can do something similar with the Code Runner extension with vscode [1] Been able to simply and quickly run code in a variety of languages with little friction is a handy thing to have, particularly when writing fragments in multiple languages at the same time. [1] https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner https://marketplace.visualstudio.com/items?itemName=formulah...
- venantius 9y agoNim seems like a great language -- certainly people who use it seem to extoll its virtues -- but I see this getting submitted and making it to the front page essentially every month. Unless there's some news about Nim that's pertinent, perhaps we could give it a rest?
- dom96 9y agoThe reason that it was submitted this time is because of a new website that we just released. I hope you can agree that this is a valid reason for the submission.
- kbd 9y agoThanks, I wouldn't have even clicked through if you hadn't written. New website looks nice!
- akkartik 9y agoThis feels like one of the exceptions where you should be allowed to change the page title. Perhaps if you prefix the title with "Show HN: " it would be ok to not use the default title. Something like "Show HN: Nim revamped its website" might be worth a try.
- nickpsecurity 9y agoI like that. I was originally with venantius where it should be something new. That was by looking at the title alone, though. Yours would be much better.
- rdtsc 9y agoUber gets submitted. Go. Erlang. Machine learning libraries. Stratups advice. A lot of things get submitted over and over. If people want to give it a rest they won't upvote and it won't show up on the front page. It's pretty simple. But there is interest so it shows up. Don't see it as a big deal, seems to work as designed.
- 9y ago
- mattnewton 9y agoLike the new design, old site looked very dated, which unfortunately matters a lot when attracting mindshare. Kudos to the team that rolled this out, nim looks much more modern and loved at first glance now.
- choward 9y agoWhenever I see a new project my first question is always "why?". From the FAQ: Why yet another programming language? Nim is one of the very few programmable statically typed languages, and one of the even fewer that produces native binaries that require no runtime or interpreter. That's it? That doesn't answer the question at all. In fact, it makes it even less clear. All it says it that there are other programming languages that have similar features. Who cares?
- Varriount 9y agoWell, if you look at the front page, you'll also see: High-performance garbage-collected language Compiles to C, C++ or JavaScript Produces dependency-free binaries Runs on Windows, macOS, Linux, and more And of course, the "Features" button right under the text leads to https://nim-lang.org/features.html https://nim-lang.org/features.html
- kem 9y agoNim looks great, but I have to admit after looking through the website it's unclear to me why I would use this over similar alternatives. In particular, why Nim over Go (or why Go over Nim)? Is the Python's established presence and resource base (not trivial at all) the only reason one would prefer it over Nim?
- jjnoakes 9y agoGo doesn't support as many platforms as Nim, for one. And Go doesn't give you access to as many system libraries, for a second. There's cgo, of course, but that has its own can of worms. I hear the type systems are fairly different as well, which is important to some.
- nimmer 9y agoNim is programmable with macros and templates and very flexible. Go is not at all.
- 9y ago
- FridgeSeal 9y agoAs someone who does a lot of Python programming, I really love the idea of Nim, and I've started learning it, I just need to find some more time to get back to learning it. Given there's a pandas style + out-of-core support I'm interested in trying to use it for a lot of data extraction + cleaning + prep sort of tasks given how speedy it can be, being built on top of C...
- kootenpv 9y agoAre you saying there is some library already existing? I'd be curious to try it then.
- FridgeSeal 9y agoSorry I only just saw this message: yeah, turns out there's 2: * https://github.com/qqtop/nimdataframe https://github.com/qqtop/nimdataframe And * https://github.com/bluenote10/NimData https://github.com/bluenote10/NimData
- brown-dragon 9y agoNim is a great little language - it is enjoyable to work in and small enough to learn easily. It's neat for little utility programs that are "too big for bash" and "too small for java/C". Sometimes I think of it as an alternative to python.
- kaushalmodi 9y agoI dig the changes in the landing pages, but I wished the documentation pages got the same treatment. At present, the documentation is not readable easily on mobile browsers. Are you considering converting the documentation pages to responsive design too? Also the black and yellow theme looks great on the home page, but that theme loses its continuity on all the other pages. It's as if the home page was designed by a different person, the feature and other landing pages by someone else, and the documentation pages by someone else altogether.
- dom96 9y ago> Are you considering converting the documentation pages to responsive design too? Unless someone volunteers to do this it likely won't happen any time soon. As for the continuity. Not all pages can have the same "section" style, the documentation page for example is just composed of a list of links and descriptions. Of course, if you have ideas on how to improve the continuity then I'm all ears :)
- kaushalmodi 9y ago> Not all pages can have the same "section" style, But they can have the same CSS styling (colors, fonts, responsiveness, etc) that ties the whole site together. A good example that's at the top of my mind is this: https://hugodocs.info https://hugodocs.info It works great on desktop as well as phone, and a common theme is seen all across the site. > the documentation page for example is just composed of a list of links and descriptions. By the documentation page, I meant a page like this: https://nim-lang.org/docs/manual.html https://nim-lang.org/docs/manual.html That's a lot of good info but is not accessible in a good way on phone. For sort of an equivalent reference, see https://hugodocs.info/templates/base/ https://hugodocs.info/templates/base/ It has a similar collection of help pages and the design is responsive too.
- dom96 9y ago> > Not all pages can have the same "section" style, > But they can have the same CSS styling (colors, fonts, responsiveness, etc) that ties the whole site together. > A good example that's at the top of my mind is this: https://hugodocs.info https://hugodocs.info > It works great on desktop as well as phone, and a common theme is seen all across the site. I might be missing something but the website you linked has only two pages and I would consider them to lack continuity even more than the current Nim website. The layout for the "docs" page is completely different to the home page. > By the documentation page, I meant a page like this: https://nim-lang.org/docs/manual.html https://nim-lang.org/docs/manual.html Oh I understand where you're coming from a bit more now. Everything under the `docs/` is sort of separate, it's part of Nim's doc gen generator and thus has a different style associated with it. But I can see why you think it loses continuity.
- beefsack 9y agoIf anyone was interested, the markup theme is Dracula[1], which subjectively feels like the most readable highlighting theme I've ever used. [1]: https://draculatheme.com/ https://draculatheme.com/
- mattbettinson 9y agoDamn that is really nice.
- favadi 9y agoThe bright color hurts my eyes :(.
- sgt 9y agoI've applied to Terminal.app now. Works like a charm. The only thing is that by cloning the git repo using "git clone https://github.com/dracula/terminal.app.git" https://github.com/dracula/terminal.app.git" it gets put into a folder called terminal.app, which is not readable when trying to import it from Terminal since it thinks it's an app. The solution is to move the Dracula.terminal file to another location before importing.
- jonathonf 9y agoEasy enough to solve, just change the destination directory: git clone https://github.com/dracula/terminal.app.git terminal-theme
- TheSmoke 9y agoi didn't like it in emacs but in iTerm it is really great. thank you :)
- twoquestions 9y agoBetter than Solarized Dark! Wonderful!
- stuaxo 9y agoFor some reason it reminds me of the various 8 bit computers colour schemes.
- spinningarrow 9y agoWhen trying out a new language, one of the first things I look for is a Getting Started/Quick Start guide that'll get me up and running with executing some code on my computer. Is there something like that on the Nim website? There's a code example on the home page but after doing a `brew install nim` I don't actually know how to run it. In the Documentation section there are guides about the standard library and so on but I can't find a 'quick start' that'll get my hands just a little dirty without feeling overwhelmed with too much information.
- halestock 9y agoNim by Example (https://nim-by-example.github.io/getting_started/ https://nim-by-example.github.io/getting_started/) should help out there.
- elpres 9y agoThere is "How I start" http://howistart.org/posts/nim/1/index.html http://howistart.org/posts/nim/1/index.html
- deleted 9y ago[deleted]
- executesorder66 9y agoIf you like Nim, check out this blog. [0] [0]https://hookrace.net/ https://hookrace.net/
- Immortalin 9y agoOne thing I have always hated about languages that tout easy C interop is the fact that you have to declare the C function first. A lot of C libraries e.g. Guile uses all sorts of Makefile hacks that makes it impossible, not to mention extremely time consuming to write a function declaration. Things would be so much easier if languages can implement something like Julia's ccall or a similar mechanism to allow direct calling of C libraries without any for of headers or wrapping.
- ptx 9y agoAren't you still writing the equivalent of a function declaration, but at the call site? What makes Julia's approach easier to use with Guile?
- oceankid 9y agoHuge update on the website. Dope!
- squarefoot 9y agoVery nice dark main page, but the others have a different brighter (ouch!) theme, and the Examples one renders badly here (small netbook, Palemoon 27.2.1 on Debian amd64) due to high pitched fonts. Examples code blocks also do not use the same font size so I believe it's just a matter of fixing the theme. Other pages look nice despite the small screen size I'm using right now.
- dom96 9y agoSorry about that. Any chance you could submit a bug report on GitHub[1]? Include screenshots and any other relevant information if you do. 1 - https://github.com/nim-lang/website https://github.com/nim-lang/website
- agounaris 9y agoHappy to see that nim is evolving. Any big player out there who uses nim for an important project?
- zaiste 9y agoHere's a talk by Andreas Rumpf (Nim creator) about async programming in Nim: https://www.youtube.com/watch?v=hwArqelfBBY https://www.youtube.com/watch?v=hwArqelfBBY
- jlebrech 9y agoI can see some interesting applications once we can target WASM, libraries that are client/server agnostic with clients that can join in the cloud workload comes to mind.
- dom96 9y agoWe already can target WASM[1] :). Nim's JS backend is already very useful though, you can see a game I've created using it in the features page. 1 - https://forum.nim-lang.org/t/2838 https://forum.nim-lang.org/t/2838
- jlebrech 9y agoi'd love to see something that compiles into two parts, one for the browser and one for the server from a single source and also maybe distributes trusted computations among the user base.
- jernfrost 9y agoI am stuck working on a C++ code base using Qt. Could I in theory use Nim to accelerate my development, or would it produce incomprehensible or ugly C++ code? Alternatively are there other alternatives to C++ for people who have to submit C++ code into the repository? I use other languages than C++ on a regular basis and I find it annoying to tedious the language is. So much boilerplate and repetitions.
- jhasse 9y agoSome years ago I had the idea to create something similar to CoffeeScript for C++: https://bixense.com/coffeepp/ https://bixense.com/coffeepp/ Never got through to finish it though :/
- jernfrost 9y agoLooks pretty cool, I'd love to have something like that. Preferably something which you could tweak to output C++ code matching company code style guidelines.
- gokr 9y agoI am not sure how incomprehensible it is, but I can say that the c2nim wrapper tool is pretty darn good. Andreas (author of Nim) quickly wrapped all of Urho3d in Nim almost fully automated. So IMHO Nim is a great companion to C++ libraries.
- jernfrost 9y agoPerhaps I misunderstand, but you are speaking of going from C++ to Nim, while I have to be able to go from Nim to C++ as co-workers are not going to want to look at Nim code. Nim would have to be a personal tool for me to write C++ faster.
- deleted 9y ago[deleted]
- deleted 9y ago[deleted]