7 ms·
Nim language v0.18.0 released
- airstrike 9y agoEvery time I see news about Nim I just wish Cobra[0] would get the same love... [0] http://cobra-language.com/ http://cobra-language.com/
- kbd 9y agoRecent News 2013-12-23 Cobra 0.9.6 has been released. Maybe because this is Hacker "News" and Cobra hasn't had a release in 4-5 years is why it's not mentioned much.
- pavlov 9y agoWhy?
- agumonkey 9y ago> First class support for unit tests and contracts this maybe ?
- fineline 9y agoI don't know about Cobra, but I would say Nim has first class support for unit tests. If you check out the "Testable documentaion examples" section of the article, it shows they've even added support for testing sample code in inline function documentation. This is a really interesting approach. I don't use Nim myself (not a "systems" programmer - what a silly term that is, we all make "systems" but I guess that boat has sailed) but I'm interested in applying a similar approach in other languages.
- scardine 9y agoNot the parent but my personal pet-peeve is case-insensitive variable names - a deal breaker for me.
- _sdegutis 9y ago> "That means only the first letters are compared in a case sensitive manner. Other letters are compared case insensitively within the ASCII range and underscores are ignored." [1] Wow, this is strange. I understand the reasoning but strongly disagree with it. Not sure if it's a deal-breaker for me though, just... strange. [1]: https://nim-lang.org/docs/manual.html#lexical-analysis-identifier-equality https://nim-lang.org/docs/manual.html#lexical-analysis-ident...
- throwaway7645 9y agoNim transpiles to C, C++, or JavaScript so it can run on nearly anything (Windows, Linux, MacOS, embedded to some degree, web browser...etc). Cobra appears to be .NET, so a little more restricted I guess.
- carterza 9y agoCompiles... compiles. Edit - Sorry - that was rude. I should have elaborated. Transpiling is a specific type of compilation that involves two languages with a similar level of abstraction. Compilation involves languages with different levels of abstraction. Nim offers a much higher-level abstraction than C, thus you could consider the process of converting Nim to C, a compilation process rather than a transpilation process.
- throwaway7645 9y agoThis comes up everytime i post about this and most people agree with me that transpile means convert to a different source language. It is definitely a common use, but I realize it is a gray area. Edit: Compiling def isn't wrong, but Transpiling is more descriptive to me as it indicates you're not going to assembly or machine language or something like that.
- dom96 9y agoCompiling is the correct terminology here. Nim transpiles to JavaScript, but it compiles to C and C++. You don't say that Rust transpiles to LLVM IR, do you?
- felixangell 9y agoI would say compiles is a more general form of transpiles. Transpiling meaning it compiles into a higher level form i.e. c, C++, JavaScript, and compile meaning it compiles into a more lower level form i.e assembly, bytecode, etc? That's just how I look at it anyway.
- throwaway7645 9y ago
- the_duke 9y agoSeems like nim is still doing well and progressing. I last looked into it about 2 years ago, when the library ecosystem was very bare-bones and the language quite buggy, but promising non the less. Clean, Python-like syntax and generally a joy to code in. Anyone here actively using Nim and can share some insight into it's current state?
- carterza 9y agoI've written quite a few personal projects in Nim, and I love programming in it. Nim is garbage-collected and the GC is not a stop the world GC, so the language is well-suited for game-development. Its standard library is improving with each release, and is already equivalent to what you expect from most modern programming languages. It contains flaws and inconsistencies, but it is being worked on and stabilized for a 1.0 release of the language. The ecosystem is small - but growing. Some of the great things about Nim - 1) Ability to interface with C/C++/Obj-C/JS 2) Can compile to any of ^ 3) Meta-programming 4) Python like syntax 5) Small binaries 6) Can compile to WASM via emscripten I've built AWS lambda jobs with Nim by interfacing with Python, as prototypes for work, but I've never been able to leverage the language in production. I really only use it professionally to replace personal shell scripts or other tasks I've previously automated. That said - Nim has a bright future - it needs to mature and hit 1.0 and it could really use some more interest as well as sponsorship. Github - https://github.com/zacharycarter https://github.com/zacharycarter
- mlevental 9y agohow does it compile to wasm if it has a GC?
- jitl 9y agoProbably it builds the GC into the WebAssembly output.
- szemet 9y ago5) Small binaries That part is amazing. I personally do not have a real use case to exploit it [1], just find it neat from an engineering viewpoint... I guess, it has an aggressive dead code removal process, compared to other - nowadays hot - compiled languages (Go, Haskell, Rust, D, Crystal). In those languages if you use a small part of their standard library, you usually get large chunks of it linked in statically (+ runtime if there is such)... (Once I've tried LTO with one of my Rust project: it increased the build time tremendously but in the end it managed to shave off only 30KB from my several MB binary...) [1] If I would try micro controller programming ever, I probably would give Nim a shot because of this...
- komerdoor 9y agoI will just repost my old post, but a lot has happened since then: Nim comes very close to be the perfect language for me (game development, machine learning etc.). Some things I experimented with including some links to show what I tried as follows: - Fully controllable and plugable GC: I can decide for myself when the GC runs and for how long. Very important for games. If I do not like the GC I can even write my own or choose one of the many existing ones. See: http://forum.nim-lang.org/t/2646 http://forum.nim-lang.org/t/2646 - Meta-programming, templates, concepts etc.: To be able to write a machine learning library I needed something that can replace simple code (DSL) with more complex code using scalar math, SIMD, SPIR-V, OpenCL or Cuda. I also wanted to be able to automatically generate bindings for scripting. See: http://forum.nim-lang.org/t/2654 http://forum.nim-lang.org/t/2654 and http://forum.nim-lang.org/t/2635 http://forum.nim-lang.org/t/2635 . As I understood by reading the forums they will soon merge in many concept improvements. See: http://forum.nim-lang.org/t/2396 http://forum.nim-lang.org/t/2396 - Nim itself can be used as an embedded scripting language: Nim as a scripting language is used by the compiler to run Nim while compiling to generate new code. Nim as a scripting language can also be used as a more advanced configuration language (like Lua in the beginning). It can be used as an embedded or standalone scripting language as well. See: http://forum.nim-lang.org/t/2647 http://forum.nim-lang.org/t/2647 and https://github.com/komerdoor/nim-embedded-nimscript https://github.com/komerdoor/nim-embedded-nimscript - Compiling to C89 code (useful for creating libraries and cross-platform support etc.): I want my games to compile on platforms not supported by GCC or Clang/LLVM (actually I am sure they can support them all after some patching) but with their own C89 compiler. After compiling to C it is easier for me to see what the code will actually do. Still if I really want to I can choose to compile to Javascript, C++, Objective-C and LLVM (not officially included yet) as well. See: https://github.com/arnetheduck/nlvm https://github.com/arnetheduck/nlvm - Pretty good functional programming support (as far as compiled code allows for): For this I created a library that use the zero-overhead iterators. There are many alternatives as well and I like to be able to choose between multiple implementations of higher level functionality. See: https://gist.github.com/komerdoor/70d9c25820952624cf797890a1.. https://gist.github.com/komerdoor/70d9c25820952624cf797890a1.... . Of course a better implementation is possible by combining this with concepts, generic dynamic method binding and all other of Nim's features. See the following again: http://forum.nim-lang.org/t/2654 http://forum.nim-lang.org/t/2654 - Easy integration of existing C code: I wrote part of my code in C (low-level) and another part in Nim (mid-level). Some things which may get new Nim users in shock but I learned to love: - Use of indentation using spaces for grouping like Python: I never really liked this but I cannot ignore that this made my code easier to read and discourages my preference for one-liners (yes I know bad habit and does not work well inside editors and with source-control). - Multiple ways to write the same identifier (case/underscore insensitive): Liked this from the beginning. I am really consistent to choose a single style but all my C code is written using underscore (ex.: typens_do_something(x)) while in Nim in prefer to use camel case (ex.: typensDoSomething(x)) or fully drop the namespace entirely (ex.: doSomething(x) or x.doSomething()). - Multiple ways to call methods: Both "abc".toUpper() and toUpper("abc") are the same. There are no namespace conflicts because Nim uses the best match for toUpper like: func toUpper(c: char): char or toUpper(s: string): string. It also makes it easier to add new methods for existing types while still being able to call the methods like if OOP is being used. - Minimal support for OOP but encouraging composition over inheritance