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
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
Christian Ortiz
The main developers are pretty intelligent (I'm most familiar with Araq and dom96).
$ 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
Andrew Thomas
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
Lincoln Hill
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.
Jace Rogers
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
Ayden Morgan
Why would you cross compile nim to c++ instead of writing c++? Are you dumb?
for a superior C++ FFI, when working with C++ libraries
Jose Sullivan
it goes without saying that you would not yourself want to write C++
Parker Gutierrez
is it memory safe? does it allow fearless concurrency?
Grayson Diaz
C++ libraries idiot, C++ is shit
Mason Cooper
t. brainlet
Levi Harris
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.
Mason Rodriguez
it really is
Liam Moore
What does it compile to when no external language is specifiec? What is its default output?
Charles Bell
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.
Jeremiah Gonzalez
So instead of using C++ you use this shit and then get C++ anyways? What's the quick win here then?
Ethan Richardson
man it's real fucking boring having to explain compilation to people on Zig Forums a hundred times a year.
Justin Carter
trash
Landon Gutierrez
Crystal is better. Prove me wrong.
Dominic Evans
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.
Jordan Carter
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.
crystal is good but isn't really comparable in a lot of ways
Brandon Gomez
what exactly are you interested in?
nobody uses that ide for nim, there are vim/emacs/vscode plugins
Hunter Nguyen
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.
Brayden Ward
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.
Bentley Williams
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.
Brandon Bennett
reeeeee dont insult the flavor of the month meme lang reeeeeeee
Anthony Parker
epic xD. I love reddit too haha
Christian Morgan
'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
Jose Perry
Nim needs to get mainstream, then getting as many libraries as possible (like Python)
Jason Bennett
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.
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
Leo Ramirez
heh, /g/
Joseph Hall
He seems like a real faggot (wants the CoC real bad)
John Wood
what library do you need that nim doesn't have?
I didn't know that
Blake Parker
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.
Chase Reyes
Everything from Keras to Django/Flask to Selenium/bs4 to NLP to the SciPy suite of libraries
Anthony Davis
HA. You have genuinely not searched AT ALL. I can name replacements off the fucking top of my head you idiot.
Ryder Cook
...
Angel Reed
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)
Anthony Miller
DO IT
Cooper Baker
clang is now distributed with the base OpenBSD system.
James Morgan
ok, then just change cc to clang to config/nim.cfg before running build.sh ... I still can't get past 'koch tools' though.
Tyler Price
what does it say? I've seen people use it on openbsd b4
John Roberts
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
Ayden Myers
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.
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.
Can you compile it to a lower level language, like asm?
Luke Brooks
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.
Alexander Diaz
Then is a transpiled language.
Nathan Brown
lol asm is intermediate language
Jace Gonzalez
this is you
Chase Sanchez
asm is a lower level language.
So is gimple.
Ian Allen
gimple isn't a programming language, though.
Carson Rivera
I've really got to liking it, the extra stuff doesn't really do anything bad except look weird
Thomas Brooks
There is a different version you can use for that but it makes no sense to
Jace Reed
What is "this different version"?
Isaac Adams
That idiot is referring the the bootstrap, which is written in C.
Logan Carter
So you can't get it directly into a lower level language and instead must go through another high-level language?
Landon Kelly
speaking of levels, I'm lowering myself to your level by pointing out that C is a lower-level language
Xavier King
Is not.
David Flores
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.
Jacob Clark
So?
David Johnson
THAT MEANS THAT NIM IS HIGHER LEVEL
Ian Barnes
It doesn't. Both are highest level languages when you write them.
Jason Robinson
This is incredibly bad bait
Jason Evans
_____________________________________/ this is a nonsenical assertion. Are \| there lower-level languages in your |\ world? / ------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
Jack Davis
Is not my fault you are too much of a brainlet to understand C and think it might as well be machine code.
Jason Jones
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.
Jaxson Williams
just to be clear: insofar as transpiled is a meaningful word, it isn't exclusive of compiled.
Oliver Turner
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?
Aaron Ward
haha, im only pretending to be stupid guys
Hunter Walker
_________________________________________/ 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
Christian Cox
Then you should know it is as high level as any other high-level language.
Lucas Jones
_________________________________________/ 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 ).
Justin Gonzalez
...
Juan Taylor
By your logic, a library is a higher level language because it abstracted already high-level features of the language.
Jace Martinez
_____________________________< yes, that is also the case. > ----------------------------- \ \ \ >()_ (__)__ _
Evan Howard
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.
Adrian Williams
________________________________________/ 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|
Nathaniel Bell
If this is not bait, I genuinely feel sorry for your fucking family.
Jonathan Powell
trippy
Jackson Hall
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.