Nim Programming Language

nim-lang.org/

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).

- POSSIBILITIES WITH NIM -
Nim can be compiled to C, C++, AND Javascript out of the box.
$ nim c hallo.nim$ nim cpp hallo.nim$ nim objc hallo.nim$ nim js hallo.nim

- LEARN NIM -
nim-lang.org/documentation.html
learnxinyminutes.com/docs/nim/
rosettacode.org/wiki/Category:Nim

- GET HELP -
#nim @ irc.freenode.net
discord.gg/rnTh2N
gitter.im/nim-lang/Nim

Attached: logo-crown.png (1187x900, 42.02K)

Other urls found in this thread:

nim-lang.org/choosenim/init.sh
nim-lang.org/docs/koch.html
nimble.directory/
github.com/nim-lang/nimble#readme
nim-lang.org/docs/nims.html
nim-lang.org/docs/manual.html#taint-mode
nim-lang.org/docs/manual.html#statements-and-expressions-static-statementslashexpression
youtube.com/watch?v=7KjCOe0oBIw
github.com/def-/nimes
github.com/nim-lang/Aporia
github.com/crystal-lang/crystal/issues/4864
github.com/crystal-lang/crystal/blob/master/CODE_OF_CONDUCT.md
github.com/drujensen/fib
nim-lang.org/docs/manual.html
twitter.com/NSFWRedditImage

Attached: gc_latency.png (805x452, 42.4K)

Install nim with this:
curl nim-lang.org/choosenim/init.sh -sSf | sh

Attached: binary_size.png (752x452, 68.92K)

devs rejected it as pointlessly controversial, rather than saying "yeah it's but it's only controversial to garbage people"
it's a tool used to build nim itself: nim-lang.org/docs/koch.html

The main developers are pretty intelligent (I'm most familiar with Araq and dom96).

Attached: fib.jpg (969x1200, 135.12K)

Packages:
nimble.directory/
github.com/nim-lang/nimble#readme

nimble install

$ sh build.sh
$ doas sh install.sh /usr/local/bin
builds and installs in a minute, and works great. A+++ software.
not cured: nim's only approach to memory management is to have a GC
NimScript is available: nim-lang.org/docs/nims.html
but it's too limited: you can use Nim as an alternative to C, but you can't use it as an alternative to Perl
OTOH, nim-lang.org/docs/manual.html#taint-mode
defer statement for your resource management
easy compile-time work, including file I/O: nim-lang.org/docs/manual.html#statements-and-expressions-static-statementslashexpression
nim tells you if your switches aren't exhaustive
has easy-mode "I want the code like this" macros, and also more serious AST-construction macros

the gc memory safety stuff was a little weird at first, but I got used to it and the performance of the language overall is phenomenal

aye, thanks user. I'd gotten distracted by Zig (which is too much in flux and too poorly documented to really use) and Ada (which is secretly extremely cool but it has Common Lisp levels of RSI threat)
Nim might be exactly what I should be doing right now.

Zig is a really cool language, and the guy who works on it is incredible, but yeah, it's in no state to use without a ton of extra work on your part

Why would you cross compile nim to c++ instead of writing c++?
Are you dumb?

Attached: 75eda5e213e6d4544fae48903dcdd7c11fe748a2068c2a105eba20b8a5bf2187.jpg (400x250, 40.74K)

for a superior C++ FFI, when working with C++ libraries

it goes without saying that you would not yourself want to write C++

is it memory safe?
does it allow fearless concurrency?

C++ libraries idiot, C++ is shit

t. brainlet

youtube.com/watch?v=7KjCOe0oBIw
The Nightmare of Move Semantics for Trivial C++ Classes
the whole language is like this. It's just a mess.

it really is

What does it compile to when no external language is specifiec? What is its default output?

its default output is usage information. 'c', 'cpp', et al. are the commands you use to compile Nim. The only alternative is the interpreted subset of the language.

So instead of using C++ you use this shit and then get C++ anyways?
What's the quick win here then?

man it's real fucking boring having to explain compilation to people on Zig Forums a hundred times a year.

trash

Crystal is better.
Prove me wrong.

the quick win is "you get to use a language other than C++". That C++ is actually involved (when compiling with cpp) is only important for
1. FFI, which as a result is easy-peasy and easy to understand. You can go as far as injecting raw code into the output.
2. the C++ compiler you use, which takes that code and works on it.
if this were a thin wrapper and you'd possibly have to debug the C++ yourself, that's suck pretty hard. That's not the case with Nim, which handles everything for you.
The only downside is that you can't just have a 'nim compiler' on a build system; you also need a compiler for your target language.
That C or C++ is involved doesn't mean that your code has any extra overhead. It doesn't even mean that your code can only be as optimized as C code. C compilers can have an easier time with generated C code vs. nearly identical hand-edited C code. I've only seen cases of that with ATS though.

the guy who came up with Crystal realized that it would never not be shit, told the community, got told off by the community, and then abandoned the project.

What are some projects written in NIM?

github.com/def-/nimes - NES emulator.
github.com/nim-lang/Aporia - an IDE for Nim
I haven't run into anything I'm that interested in that's written in Nim.

dropped

people are idiots


crystal is good but isn't really comparable in a lot of ways

what exactly are you interested in?


nobody uses that ide for nim, there are vim/emacs/vscode plugins

Nim seems rather interesting. If you posted a couple of more posts, I think I might actually try it.

C++ is mess because it has too many features but the fact that C++ has so many features is also its greatest strength and weakness. C++ is good enough, however, C++ is seriously flawed, too.


Not always. If you are application developer, you want to have good GC.


Sauce pls. I am interested.

How is this any less pointless than any other transpiled meme lang? They all really seem like trying to turn a screwdriver with a novelty claw grabber toy.

The GC is as out-of-the-way as it can possibly be. The pause time is practically nonexistent.

There is a (largely) irrational disregard for languages when retard /g/ programmers hear "garbage collected". It has 0 performance impact unless you use it improperly (you can even configure it to your tastes), not to mention, you can disable it entirely.

reeeeee dont insult the flavor of the month meme lang reeeeeeee

epic xD. I love reddit too haha

'transpiled' isn't a category of language, you're just a brainlet. If Nim development stopped for a month so that it could get its own native code compiler, all that would happen is

Nim needs to get mainstream, then getting as many libraries as possible (like Python)

theoretically.
if you write your own stdlib.
if you don't mind not having any way to manage memory anymore.
when D people say this, they at least have betterC as a concrete example of a way to use the language, sans-GC.

github.com/crystal-lang/crystal/issues/4864 this post maybe? it's not that heated though.

Faggots like you really are the stupidest. Speed isn't the main problem of GCs, it's the greatly increased runtime complexity making a the total running code for a hello world ridiculous, greatly increased memory use and glorification of lack of rigour in programming. In this last regard, it is truly something fit for these degenerate times.

inb4 meme GC benchmarks not measuring both throughput and latency

heh, /g/

He seems like a real faggot (wants the CoC real bad)

what library do you need that nim doesn't have?


I didn't know that

This is what the founder of Nim said about CoCs.

Because it's a waste of time. The recent troll attacks wouldn't have been prevented by a CoC. CoCs are naive and actually can start all sort of fights over the precise wording etc. I can already envision this very thread to become a page long discussion with people arguing about the pros and cons about CoCs. I would lock this thread if I could (maybe I'll patch nimforum) to save everybody's time ("safety first"). Please! Before answering here: Consider working on Nim instead. ;-)

He's great.

Everything from Keras to Django/Flask to Selenium/bs4 to NLP to the SciPy suite of libraries

HA. You have genuinely not searched AT ALL. I can name replacements off the fucking top of my head you idiot.

...

wellll... downside: OpenBSD's gcc is so old, nim's C breaks with it.
there are open issues about it, and getting nim to emit egcc commands instead of gcc commands isn't trivial (gotta edit a compilerExe field and then bootstrap rebuild Nim)

DO IT

clang is now distributed with the base OpenBSD system.

ok, then just change cc to clang to config/nim.cfg before running build.sh
... I still can't get past 'koch tools' though.

what does it say? I've seen people use it on openbsd b4

it's specifically 'koch nimble' that fails.
nimblepkg/options.nim(128, 14) Warning: Couldn't determine GIT hash: fatal: not a git repository (or any parent up to mount point /home)Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). [User]nimblepkg/options.nim(215, 6) Hint: 'options.renameBabelToNimble(options: Options)[declared in nimblepkg/options.nim(215, 5)]' is declared but not used [XDeclaredButNotUsed]Hint: download [Processing]Hint: packageparser [Processing]nimblepkg/packageparser.nim(3, 67) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]Hint: nimscriptsupport [Processing]nimblepkg/nimscriptsupport.nim(8, 11) Error: cannot open file: compiler/astFAILURE

Seems like a good idea, but I can't see myself using it in production. Look at all the superfluous instructions it generates for a simple blurb of JavaScript.

Attached: compiled_to_js.PNG (424x233 70.58 KB, 12.6K)

Here you go:
github.com/crystal-lang/crystal/blob/master/CODE_OF_CONDUCT.md

Q.E. fucking D.

The dumbasses can't even tell the difference between a compiled language and a transpiled language.

Attached: raff.jpeg (220x229, 8.21K)

I've been using nim quite a bit lately and it's been damn nice. It offers multiple GC implementations alongside an off option for tailoring to your needs. On top of that the FFI is one of the simplest implementations I've ever had the pleasure of using, so using existing C code is painless, and also lets you bypass the GC altogether. You can even use pragmas to include the necessary sources into the build from your nim modules. The language feels like what python should have been.

but nim is both?

>github.com/drujensen/fib

Can you compile it to a lower level language, like asm?

yeah. it happens automatically, and it involves a bunch of intermediate languages. Which is exactly what happens when you compile a C program with a C compiler.

Then is a transpiled language.

lol asm is intermediate language

this is you

asm is a lower level language.


So is gimple.

gimple isn't a programming language, though.

I've really got to liking it, the extra stuff doesn't really do anything bad except look weird

There is a different version you can use for that but it makes no sense to

What is "this different version"?

That idiot is referring the the bootstrap, which is written in C.

So you can't get it directly into a lower level language and instead must go through another high-level language?

speaking of levels, I'm lowering myself to your level by pointing out that
C is a lower-level language

Is not.

just go down side bar at nim-lang.org/docs/manual.html and look at all the shit that you can only cobble together from spit and dirt if you use C.

So?

THAT
MEANS
THAT
NIM
IS
HIGHER
LEVEL

It doesn't. Both are highest level languages when you write them.

This is incredibly bad bait

_____________________________________/ this is a nonsenical assertion. Are \| there lower-level languages in your |\ world? / ------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

Is not my fault you are too much of a brainlet to understand C and think it might as well be machine code.

nope. for example python is higher level language than C/C++ then there is ASM and finally machine code is the lowest level before electronics.

just to be clear: insofar as transpiled is a meaningful word, it isn't exclusive of compiled.

ASM and the bytecode that java and the likes use. Also compiler intermediary languages.


Python is as high level as C.


My original question was: can it be compiled to a LOWER level language?

haha, im only pretending to be stupid guys

_________________________________________/ I don't have any trouble understanding \| C. It's much harder to understand || languages like Nim and Ada, simply || because they have more features. People || screw up C, but screwing up with a || hammer doesn't make a hammer a power |\ tool. / ----------------------------------------- \ \ /\_)o

Then you should know it is as high level as any other high-level language.

_________________________________________/ you can write any turing-complete \| language in any other turing-complete || language. You can write a C compiler in || Python. As that's the case, it || obviously has no bearing on how high- |\ or low-level a language is. / ----------------------------------------- \ \ \ \ /\ ( ) .( o ).

...

By your logic, a library is a higher level language because it abstracted already high-level features of the language.

_____________________________< yes, that is also the case. > ----------------------------- \ \ \ >()_ (__)__ _

No, is not. Everything is high-level. When you start having code that is not meant to be edited by humans, then you went down a level. When it deals directly with hardware instructions, that's another level.

________________________________________/ every time you say 'everything is high \| level', you're just attempting to do || away with the distinction. You can't || deny a classification system while || arguing about how languages fit into |\ it. / ---------------------------------------- \ /\ ___ /\ \ // \/ \/ \\ (( O O )) \\ / \ // \/ | | \/ | | | | | | | | | o | | | | | |m| |m|

If this is not bait, I genuinely feel sorry for your fucking family.

trippy

now lets slow down. python is interpreted by an interpreter written in c. It would be idiotic to compile python directly; it has to run on top of a lower level vm. nim could be compiled directly, they just haven't got around to it yet.
It's hilarious how quickly the original question gets lost. Anyways, you can compile it to c, and then compile the c to asm; therefore it can be compiled to asm. The internal details of the compiler are irrelevant.

basically this. The real question for low levelness is how much access to the hardware you have, not what compiles what.


_____________< this is fun > ------------- \ / \ //\ \ |\___/| / \// \\ /0 0 \__ / // | \ \ / / \/_/ // | \ \ @_^_@'/ \/_ // | \ \ //_^_/ \/_ // | \ \ ( //) | \/// | \ \ ( / /) _|_ / ) // | \ _\ ( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-. (( / / )) ,-{ _ `-.|.-~-. .~ `. (( // / )) '/\ / ~-. _ .-~ .-~^-. \ (( /// )) `. { } / \ \ (( / )) .----~-.\ \-' .~ \ `. \^-. ///.----..> \ _ -~ `. ^-` ^-_ ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ /.-~

the worst part of cowfagging is the term itself

No they are not because you are bound to what C can do. nim becomes useless if you can't do anything C can't.