
Nim programming language - evacchi
https://nim-lang.org/
======
cjhanks
Nim 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!

~~~
gigatexal
+1 to the usefulness of a REPL. Anyone know of a good one for the vanilla Java
language?

~~~
moomin
I 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
I 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
Sorry, 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...

~~~
gigatexal
I guess I just need to read up on how to actually use maven the right way.
Thanks.

~~~
moomin
I wouldn't use Maven, but there are multiple tools that can use Maven
repositories that aren't Maven, and I'd recommend one of those. :)

~~~
gigatexal
I was only trying to learn it because a take home coding assignment for an
interview asked to use maven for its build process. I found the whole
experience (using maven) disheartening while I was able to code up the
assignment using maven and my inexperience with it cost me going to the second
round. I have only myself to blame though.

~~~
moomin
That sucks :(. But I can tell you there are plenty of organisations (e.g.
Thoughtworks) where Maven is regarded as a bad tool that should be avoided.
That doesn't help you much if it's part of a job you want, though. :(

------
beefsack
If 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/)

~~~
sgt
I'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
Easy enough to solve, just change the destination directory:

    
    
        git clone https://github.com/dracula/terminal.app.git terminal-theme

------
mattnewton
Like 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.

------
FridgeSeal
As 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
Are you saying there is some library already existing? I'd be curious to try
it then.

~~~
FridgeSeal
Sorry 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)

------
Immortalin
One 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
Aren'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?

------
jernfrost
I 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
Some 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
Looks 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.

------
agounaris
Happy to see that nim is evolving. Any big player out there who uses nim for
an important project?

------
kaushalmodi
I 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
> 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
> 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
> > 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.

------
executesorder66
If you like Nim, check out this blog. [0]

[0][https://hookrace.net/](https://hookrace.net/)

------
brown-dragon
Nim 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.

------
zaiste
Here'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)

------
spinningarrow
When 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.

~~~
elpres
There is "How I start"
[http://howistart.org/posts/nim/1/index.html](http://howistart.org/posts/nim/1/index.html)

------
squarefoot
Very 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
Sorry 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)

------
venantius
Nim 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
The 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.

~~~
akkartik
This 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
I 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.

------
jlebrech
I 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
We 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
i'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.

------
oceankid
Huge update on the website. Dope!

------
choward
Whenever 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?

~~~
MichaelGG
How does it accomplish tracing GC without a runtime?

~~~
Varriount
It doesn't have a tracing GC (or at least, the primary portion isn't tracing).
The garbage collector is outlined at [https://nim-
lang.org/docs/gc.html](https://nim-lang.org/docs/gc.html)

~~~
MichaelGG
It says it has to scan the entire threadlocal heap with mark and sweep. What
am I missing?

Anyways I'm sorta being pedantic that it obviously has some sort of runtime.
Maybe they meant to say not a runtime like a full VM ala Java?

~~~
vinceguidry
The whole language compiles to C, C++, or Javascript. It presumably uses
whatever runtime the compiled-to language provides.

~~~
MichaelGG
Well C doesn't ship with the GC described, so it must include some additional
runtime beyond the C library.

