7 ms·
NIR: Nim Intermediate Representation
- gorenb 3y ago[flagged]
- michaelsbradley 3y agoThe PR was created a couple of hours ago, and I saw it mentioned in the Nim community's Discord server. I did not mention in Discord that I submitted the link to HN, but I'm guessing a fair number of the participants there also browse HN regularly, so that could be a factor.
- PartiallyTyped 3y agoHN seems to like Nim and more exotic (though not esoteric) languages.
- hifromwork 3y agoMy guess is as good as yours, but it could be a moderator action. Sometimes submissions are manually upgraded/downgraded by moderators here (that would be dang). Related: https://hn.algolia.com/?dateRange=all&page=0&prefix=false&sort=byDate&type=comment&query=%22upvotes%20alone%22%20by:dang https://hn.algolia.com/?dateRange=all&page=0&prefix=false&so...
- Uehreka 3y agoIt’s an article about programming on a website frequently visited by programmers that was posted in the middle of a Saturday afternoon (America time) when a lot of people have read the front page already and might be looking at /new? Doesn’t seem so crazy to me.
- gorenb 3y agois nobody here understanding? i meant what i said. it interests me. i think this is really cool, and a really interesting thing. i enjoyed this, and im happy its on the front page.
- suby 3y agoI like links like this because I like discussions on programming languages which are just on the periphery of mainstream. Nim, dlang, Odin, Zig, etc
- gorenb 3y agoNo, the HN algorithm has seemed to stress newer posts recently, which is interesting.
- dang 3y agoThat's not so uncommon. I looked at the vote data and it seemed legit.
- gorenb 3y agoI didn't think it was illegitimate. I think the HN algorithm has began to stress newer posts to go the top page. I'm not sure if that's a bad thing or not. This could also mean that you can check HN every thirty minutes and see something completely different. I personally think this is a good thing.
- dang 3y agoThe HN algorithm hasn't changed recently. Who knows what else may have changed, but not that!
- davidthewatson 3y ago"No pointers, no cry" was worth the price of admission. There are features and benefits here that seem magical. I may be misunderstanding, but does this mean that you could compile directly into containers like podman? That is, is the NIR parse able as a container image?
- jjtheblunt 3y agoA container image is essentially a generalization of a binary, a folder holding the binary to run with its dependencies in a format that docker/podman can read, unpack/uncompress, mount the folder and thereby its contained dependencies and binary, sets up unix accounting, and run the binary with its support dependencies. A compiler intermediate representation looks like a collection of data structures that can be used to generate runnable code either immediately as in an interpreter or saved for later use. I think you’ve compared very different ideas.
- unclad5968 3y agoTheyre going to change the whole backend essentially just for better not nil and static array bounds checking?
- zem 3y agothat "just" strongly underestimates the value add of those two features!
- unclad5968 3y agoThe features already exist and the topic doesn't indicate how they would get any better.
- hashtag-til 3y agoHaving a structured IR could make it pluggable to the MLIR ecosystem, for example.
- mathisfun123 3y agoJust because it has IR in the name doesn't mean there's any connection. If you want to emit MLIR using nim you can already do this using MLIR's C API, if you want to map nim ast to to existing MLIR IR you can already do this if you provide the necessary control flow analysis, if you want to map nim ir to MLIR you will still need a lowering or nim dialect.
- red_vodka 3y agoThe mention of making CPS (continuous passing style) compiler integration possible is something very important. That would enable Go- or Kotlin-like coroutines to land in the language, which is sorely needed to end the async wars between stdlib's horrible asyncdispatch module, and Status.im's barely documented Chronos async/await implementation.
- throwmeouthn 3y ago[dead]
- jadbox 3y agoI do really like Nim, being a sister to D lang with similar benefits. The language wars feels like it's getting hotter lately, and I'd live to see D/Nim make a comeback. If any language is going to see new traction, it's going to need to be a compelling alternative for Go/Rust/JS/Python/Java. I'm keeping an eye on Zig here too.
- winrid 3y agoJust needs good IDE support. That's always the issue. Do not like VSCode or the slowness of the Nim plugin. I think every "goto definition" scans the whole code base instead of using an index, so it's slow. I'm faster working in Java, verbosity be damned.
- michaelsbradley 3y agoYou may fare better hooking VSCode to nimlangserver: https://github.com/saem/vscode-nim#nim-lanugage-server-integration-experimental https://github.com/saem/vscode-nim#nim-lanugage-server-integ...
- winrid 3y agoThanks! Still don't want to use VSCode. I'd rather not use nim until there's a supported Clion plugin.
- memco 3y agoThere is a number plugin: https://plugins.jetbrains.com/plugin/15128-nim https://plugins.jetbrains.com/plugin/15128-nim. I haven’t tried it so don’t know how well it works.
- winrid 3y agoYes, as I said, a supported plugin. The author has not updated it since Jan so its not compatible anymore, and it's in beta at best.
- visualphoenix 3y agoOh look… now we get a name collision for an intermediate representation [0]. That won’t make it difficult for searching at all… Like, this is cool and power to them, but I wish they had a different abbreviation. [0] https://www.x.org/wiki/Events/XDC2014/XDC2014AbbotNIR/ https://www.x.org/wiki/Events/XDC2014/XDC2014AbbotNIR/
- thaliaarchi 3y agoI know of at least four MIRs. I used NIR as the name of the IR of one of my compilers. It's not a big deal. Just add qualifiers to your searches.
- xwowsersx 3y agoI'm getting back into Nim after a little break. I really enjoy the language. I'm having a helluva time trying to get some basic tooling set up though. I wanted to install nimlsp[0] so I uninstalled the nim I had installed with homebrew and started over with choosenim. Still running into issues. `nimble install nimlsp` results in: nimble install nimlsp Downloading https://github.com/PMunch/nimlsp using git Verifying dependencies for nimlsp@0.4.4 Info: Dependency on jsonschema@>= 0.2.1 already satisfied Verifying dependencies for jsonschema@0.2.1 Info: Dependency on ast_pattern_matching@any version already satisfied Verifying dependencies for ast_pattern_matching@1.0.0 Info: Dependency on asynctools@>= 0.1.1 already satisfied Verifying dependencies for asynctools@0.1.1 Installing nimlsp@0.4.4 Building nimlsp/nimlsp_debug using c backend /Users/me/.nimble/pkgs2/ast_pattern_matching-1.0.0-b5b08c554b072eed227f98a437f7333584cf957e/ast_pattern_matching.nim(575, 28) Error: invalid indentation Prompt: Build failed for 'nimlsp@0.4.4', would you like to try installing 'nimlsp@#head' (latest unstable)? [y/N] Answer: n Tip: 12 messages have been suppressed, use --verbose to show them. nimble.nim(729) install Error: Aborting installation due to build failure. Then I read on some old issue[1] that I should uninstall ast_pattern_matching. I assumed this meant `nimble uninstall ast_pattern_matching` so I did that, but there's nothing to delete.. Error: Failed uninstall - no packages to delete Anyone have some advice or can provide guidance on getting nimlsp up and running? My ultimate goal is to have some basic stuff working in neovim so I can move on with writing some nim. [0]: https://github.com/PMunch/nimlsp https://github.com/PMunch/nimlsp [1]: https://github.com/PMunch/nimlsp/issues/156 https://github.com/PMunch/nimlsp/issues/156
- michaelsbradley 3y agoMaybe give nimlangserver a shot, it's an alternative to nimlsp: https://github.com/nim-lang/langserver https://github.com/nim-lang/langserver nimble install nimlangserver
- xwowsersx 3y agoThank you! Will give that a shot.
- 3y ago
- Cloudef 3y agoNo to be confused with Mesa's NIR https://docs.mesa3d.org/nir/index.html https://docs.mesa3d.org/nir/index.html
- uoaei 3y agoHow is Nim for mobile development?
- klibertp 3y agoIt isn't. And it would be hard-pressed to be, since there's no JVM backend. It could work on iOS via the C target, but you're probably better off with Swift. It could work in the browser via the C target and emscripten, but again, you probably don't want to go through so much trouble when you could just use C++. There's a JS backend, but at that point you're better off with TypeScript.
- red_vodka 3y agoYou can do Android with the C backend, but that's through some Java interop hackery, and there isn't anything in the ecosystem that would make Nim attractive for mobile development
- klibertp 3y ago> that's through some Java interop hackery Honestly - you don't want to go there. Really. The JVM is known for a high cost for native calls, and JNI is pretty painful to write for in the first place. The Android NDK doesn't provide native equivalents to application-level APIs and concepts. You, technically, can make an app with a GUI in C for Android, but as I said: unless you're a masochist and enjoy the pain, you don't want to do that :) As an aside: Tizen uses a GUI framework written in C - EFL - and it can be accessed from native and JavaScript code. I'm actually not sure how the JS APIs are mapped to the underlying framework's, if at all, but theoretically it shouldn't matter (other then what's expected between C and JS) whether you use native or JS for your apps. Unfortunately, Samsung is unable to replicate Google's level of development and (even more painful) documentation (maybe unless you're fluent in Korean). This made the transition to Android/Wear OS for new Samsung watches a welcome change, even though Tizen was arguably better in its design and some capabilities. I haven't checked recently, but I think Tizen is basically dead at this point - some smart guys at Samsung will have a blast playing with systems-level programming, but external developers will stop even considering writing for it. A pity. It was an interesting design.
- ewuhic 3y agoIs Nim getting contributions from any big players (corporations)? Does Nim ecosystem feature a SSR web framework with SolidJS-like reactivity?
- pjmlp 3y agoNice to see this evolution, as steping stone into Nim getting its own toolchain.