lainchan / λ

Nim

藤原純一 · 2021-01-29 13:25
What do you like about Nim? What do you dislike? What do you use it for?
Bob Arctor · 2021-01-29 15:14
well their website says it has "python-like syntax" so it's automatically not very interesting
Moore · 2021-01-29 17:12
>>24221 do you mean you just prefer curly brackets and semicolons over indentation and newlines ending statements or is there more to it than that?
sizeof · 2021-01-29 18:16
what do you like about it op, and what is it? that's how you start a thread
Hacker · 2021-02-03 02:47
>>24224 Significant whitespace is like kicking dead whales down the beach.
Neo · 2021-02-03 03:40
>>24280 imagine being defiant about something you would do anyway just because it's now mandatory.
Neuromancer · 2021-02-03 04:09
>>24282 Sometimes I want to break lines for readability. It's also easier to read code blocks delimited by curly barces or 'begin'/'end'.
Torvalds · 2021-02-03 10:38
>>24224 >>24283 I used to love significant whitespace basically for the "you do it anyway" argument, but I learned the hard way that, if whitespace is the only thing that encodes program structure, then if the whitespace is mangled (for example because of a silly pasting accident) the structure of the program is mangled also. Remembering or inferring the correct indentation for a short snippet of code that you've been working at for the past minutes is, quite surprisingly, nontrivial and error-prone.
queue · 2021-02-03 16:19
Wikipedia: > Fast program execution is a primary goal of Nim's development. Despite Nim's easy and expressive Python-like syntax, benchmark tests demonstrate how competitively the language runs. In various community tests, Nim outperformed many languages that hold well-established reputations for being fast, including Rust, Go, and Kotlin. Nim is competitive with C in speed, executing faster on several benchmark tests. Nim executed faster than Python by large margins in virtually every example, usually by 300+ seconds. However, most such benchmark tests did not use Nim's optimization flags during compiling. looks neat
Church · 2021-02-04 07:43
>>24289 Indeed. And the argument about forcing bad programmers to indent always feels bad faith to me. Most text editors will auto-indent for you these days, code formatters are OK-ish, and a programmer who's so bad that he won't indent his code for readability shouldn't be allowed near anything important. I don't want to use a language with a feature that cripples my ability to do things nicely just because beginners have trouble with something. I don't want to use beginner languages.
vector · 2021-02-04 08:46
I tried it, it was nice, but its documentation didn't follow in step with its standard library for a while. Maybe that's been fixed by now.
Koos van der Merwe · 2021-02-04 12:26
>>24220 I think conceps like uniform function call syntax or identifier equality are just another way to build more unstable software. Familiarization times in programs take longer because theoretically every employee in a project can name something differently or uses different calls. Some concepts should not be used in practice
Yamaoto Toshi · 2021-02-04 21:05
>>24283 >>24289 I feel like the readability part is subjective. I personally find indentation way easier to read than braces or begin/end statements, and I know lots of people agree with me.
Emmanuel · 2021-02-04 23:27
>>24321 If you use a language with significant whitespace, it can be difficult to judge which 'else' correspond to which 'if' if the space between the two is long.
Jet Black · 2021-02-05 01:53
>>24220 I like the python syntax, but it doesn't write like python at all and the stdlib is weird to work with. I hate how it enforces camelCase for functions, and how its package manager makes it impossible to install and use libraries system-wide, like Go does. I'm not using it for now.
Unknown · 2021-02-05 14:13
I've been looking into it, and it seems to have fallen into the same trap D did, where it tried to strike a compromise between high and low level programming and ended up being unsuitable for either.
Hououin Kyouma · 2021-02-14 10:52
>>24343 That does sound concerning, elaborate
SHODAN · 2021-02-16 00:18
>>24323 It's the same without significant white space.
Knuth · 2021-02-16 02:44
>>24482 To me, the ending curly brace at one specific indent level makes it clear how an 'else' relates to a previous 'if'. That extra information is lost in languages without curly brace/begin end blocks. Haskell is a great compromise in my opinion, giving the user the option of using significant whitespace and letting the compiler figure out how the program is structured, or use curly braces C-style and indenting however you want.
Nell · 2021-02-16 06:00
>>24485 You mean the fact that else is proceeded by a brace on the same line? like "}else{" instead of "}\nelse{"? That tells how "else" relates to "if", but doesn't tell you which "if" it goes to. Otherwise, no information is technically lost, since you could always add a bracket for each dedentation. Or are you saying that it's easier to count the brackets rather than dedentiation? I'm confused, cause i always just scan along the indentation level, even when there are braces.
藤原純一 · 2021-07-04 20:31
What's Nim compiler are out there and what licenses do they use?
roll · 2021-07-04 21:57
>>26546 MIT https://github.com/nim-lang/Nim/blob/devel/copying.txt There is an older version of the compiler written in C so nim is bootstrappable, if you'd like to know. Nim is probably already in your repos so you can just apt install nim and use it.
Aristóteles Amadópulus · 2021-07-05 09:43
>>24221 Small syntax details are completely irrelevant. Why not talk about something like the macro system?
if · 2021-07-05 21:41
>>26547 and it's not dependent on anything closed source, right?
Anamika · 2021-07-06 00:13
>>26566 It's not.
aliased · 2021-07-06 18:20
>>26569 Excellent, recently I heard about how rust can't boostrap itself and something about being it dependent on closed source stuff that I can't recall correctly. So this Nim is in a better position, more reasons to use it.
Rick Deckard · 2021-07-15 20:44
I got a good full time job writing Nim code and overall I'm quite happy with it. The job involved a clean codebase from scratch so that helped coming from no experience with Nim, it was a fresh start to use something new. In hindsight however I wish I had learned more of the fundamentals before getting to 5000 LOC for the product that's the main focus of my work. It's not that big yet but I think I made a lot of mistake early on and I'm kind of struggling to put the genie back in the bottle now. There's a ton of global memory, lots of side effects when calling functions, I think the types system is probably reimplemented in a few different places for questionable reasons. I'd like to go back and create some objects just to store configuration, and ideally I would have used funcs instead of procs. Ah well, maybe one day I'll get to where I'm good enough with Nim to say I produced something other than a massive cluster fuarrrk. Wiretracking and Pure Funcs sound quite interesting - perhaps one day if I can dig myself out of the current pile of soykaf code in which I sit I may take a stab at those Nim features.
renames · 2021-07-17 11:11
>>26766 Tell your story, lainon. All too often language enthusiasts like myself forget that no fancy language can prevent a programmer from cooking up a huge plate of spaghetti. I went to the book thread and posted a couple of books that might help or encourage you: >>26791. Chapter 1 of Clean Code came to mind when I read your post, as it speaks of improving code quality over time with small changes. Both also have chapters dedicated to refactoring. Godspede.
Donna Hawthorne · 2021-10-21 10:08
i just saw asukadomo post some intellectually stimulating discussion about nimrods >>1_000_000 >>_ can be put anywhere in numbers and is ignored >>wigglers will have heated debates in the future whether >1_00_000_000 should be valid syntax because they lost $2 Trillion USD from a cryptocurrency bug >>discard get_date() >>an expression being unused is an error unless discard is used >HOW DO person whose company I enjoyS THINK THIS IS THE DESIGN SPACE >THIS DOESNT PREVENT """BAD CODE""" >YOU HAVE A BADD LANGUAGE >AND A BAD OS >YOU HAVE CREATED AND FORCED 20 LANGUAGES THAT HAVE NOT EVEN TOUCHED THE DESIGN SPACE. THEY PROVIDE TACKED ON """LAMBDAS""" AND NO GENERICS. >fuarrrk YOU >THIS IS LITERALLY (VOID)F(VOID) C AUTISMO BRAINDAMAGE FROM 40 YEARS AGO >fuarrrkING KYS
Chan Siu Ming · 2021-10-21 12:06
>>28102 Now can you repeat your argument without sperging out quite that hard? I can hardly parse it.
Guthrie · 2021-10-26 10:00
>>24220 toy lang, if you want python syntax just use python
protected · 2021-12-07 10:03
So does this nim lang have any advantages over Cython at all? "Lisp/Ada" macro system worth anything?
Haruyoshi · 2021-12-09 09:54
>>28851 Ada doesn't have a proper macro system. What Nim takes from Ada is the strong typing. Even the macro system is a far cry from the likes of Lisp. Basically, it's a completely different language from Python, the only similarity being the syntax.
Nemissa · 2021-12-09 11:16
I don't know much about its history, but to me, Nim smells of a "designer language". You get the impression the guy making it just kind of threw together all his favorite features from other languages, with no real overarching vision or intended use case.
Anamika · 2021-12-10 07:41
>>28883 >intended use case I.e. how it's marketed. Why would you need that? You can write almost anything in any general lang >real overarching vision Why ever? Also, "sum up all the good things in the PL design field" is pretty good, seeing how almost every language has some sort of deal breaker in it(performance, safety, etc...)
x<->y · 2021-12-10 13:30
>>28894 What you don't seem to realize is that features don't exist in a vacuum. You can't just ram them together and expect them to work. Choosing one feature over another means making a trade-off, and deciding to go with both a-la C++ makes the language harder to read because the programmer needs to memorize a bunch of different features to know what's going on in someone else's code, harder to write because they need to remember what's considered idiomatic where, and harder to debug because the multitude of different ways to do the same thing makes it much trickier to narrow down what went wrong where.
word · 2021-12-10 13:55
>>28906 >Choosing one feature over another means making a trade-off What features do you have in mind? I was thinking about simplicity (the python feel), type system, performance, etc which I don't think have many tradeoffs over the alternative choices. Are you talking about metaprogramming, or the standard library?
renames · 2021-12-11 23:37
What are some of the advantages of nim over crystal? Interested in learning one of them but they seem extremely similar so not sure which.
McCarthy · 2021-12-14 13:26
>>28924 Crystal is Ruby-like, so it's much better.
quote · 2021-12-14 22:14
>>28973 As in crystal or nim is much better? Planning to rewrite my python project in nim, all I want is something that can interface with python modules but doesn't take 32gb of ram and 8 hours to finish a loop.
over · 2021-12-18 08:12
>>28973 if i learn ruby as my first app language will this help me learn crystal?
Shogun · 2021-12-18 10:08
>>29064 >if i learn ruby as my first app language will this help me learn crystal? Yes. But wtf is "app language" , troll?
Cat Mother · 2021-12-18 13:26
>>26590 I've successfully bootstrapped rust using mrustc before. It's a pain since you have to build every version since the last version mrustc was able to build but not impossible. Meanwhile, nim has a bootstrap "source" that's just autogenerated C source from an older version of Nim. Not as bad as a "real" binary but quite close. Haven't seen any other methods of bootstrapping Nim.
overriding · 2022-07-13 14:37
>>28973 It's a shame Crystal is so much slower than the other unpopular langs
null · 2022-07-14 04:18
When does it get beyond the babby transpiler phase and why isn't https://github.com/arnetheduck/nlvm embraced by upstream? >>28894 If they manage an actually very good execution of this hodgepodge, it could be a good replacement for Go/Python/Julia. Right now, it's still just an interesting joke, though.
Elliot Alderson · 2022-07-14 09:17
>>31831 >babby transpiler phase What's wrong with transpiling?
bit · 2022-07-14 20:47
>What do you like about Nim? nothing >What do you dislike? nothing because its a memelang What do you use it for? ""
Ishikura "Tatsu" Tatsuhiko · 2022-07-15 01:54
>>31833 Added complexity of having both a transpiler and compiler, including the potential for bugs during both phases (especially when targeting something barren and full of UBs like C). Potentially limited optimizations due to lack of expressiveness of the target language, maybe. Compilation time. Decrease in debugger/stacktrace quality.
car · 2022-07-15 18:43
I use Nim for offensive hacking https://github.com/byt3bl33d3r/OffensiveNim
Hiro Protagonist · 2022-07-22 08:24
There is not one post in this thread discussing Nim
Drano · 2022-07-22 10:05
>>31851 Any reason why you prefer Nim over other popular options for offensive security like C, Go, Rust, and Python?
Mitnick · 2022-07-23 02:44
>>31977 Not him, but >C, Go Real macros, named arguments, looks cleaner and with a more usable stdlib than C. >Rust Named arguments, doesn't look like week old puke. >Python Fast and hopefully with a community less full of lusers ("scientifics" and other non-programmers attracted to Python for ML or numpy). Real macros too.
Shogun · 2022-07-24 10:20
>>31983 >"scientifics" and other non-programmers attracted to Python for ML or nump Ironically, those sorts of people were the original "computer scientists". Procedural programming would've probably never happened if scientists and mathematicians didn't get involved.
J.C. Denton · 2022-07-30 16:39
GC language like Java and C# but without bytecode. >>32002 >Procedural programming would've probably never happened if scientists and mathematicians didn't get involved. I highly doubt that.
Yet Another Lainon · 2022-08-26 19:55
>>32127 Doubt all you want but it's true. Edsger Dijkstra's CS classes were about math and involved no actual computers, and the guy himself didn't even own one.
byte · 2022-08-27 02:58
>>32550 FORTRAN predates Algol and was purely an industry effort. Even the daddy of all of them, Plankalkül, was made by an engineer and not an academic.
Six · 2022-08-27 09:00
>>32552 My point still stands. The main innovations in computer programming were done by people who saw it as a means rather than an end.