Readit News logoReadit News
j-james commented on Algebraic Data Types for C99   github.com/Hirrolot/datat... · Posted by u/bondant
samatman · 2 years ago
I've been a Nim respecter for many years, it's slept on in general as a language.

The difference here is that Nim compiles to C and you can turn the garbage collector off: Zig compiles C and there's no garbage collector. That means the entire standard library is available when generating object code. It's also trivial to opt-in to the C ABI on a fine-grained basis, by defining a function or struct with the extern keyword.

I believe this is still fairly current about the difficulties of building Nim dylibs for C programs: https://peterme.net/dynamic-libraries-in-nim.html

I expect Nim will stabilize about where D has: it will have a dialect of the language which, with relatively painless accommodations, is able to produce object code which speaks C ABI. Zig is different. The language is relentlessly focused on providing a better alternative to C while occupying the same niche, and a lot of design time has been spent on making it practical to take an existing C program and start writing the new parts of it in Zig.

It's a good language, Nim, and getting better. I'd recommend it for someone who is considering Go, for example.

j-james · 2 years ago
I think this is all true. Though with regard to your earlier example, it should be noted that Nim, too, has an extraordinarily powerful compile-time programming system: but it takes the form of typed macros and generics (as opposed to Zig's dislike for such abstractions).
j-james commented on Algebraic Data Types for C99   github.com/Hirrolot/datat... · Posted by u/bondant
brabel · 2 years ago
In Nim, ADTs are painful still (as your example clearly shows), but they are working on adding proper ADTs to the language (I can't find where I read that, but I am sure I did!).
j-james commented on Rusty.hpp: A Borrow Checker and Memory Ownership System for C++20   github.com/Jaysmito101/ru... · Posted by u/stanulilic
aw1621107 · 2 years ago
> Where Rust won't compile when a lifetime can't be determined, IIRC Nim's static analysis will make a copy (and tell you), so it's more as a performance optimisation than for correctness.

Wait, how does that work? For example, take the following Rust function with insufficient lifetime specifiers:

    pub fn lt(x: &i32, y: &i32) -> &i32 {
        if x < y { x } else { y }
    }
You're saying Nim will change one/all of those references to copies and will also emit warnings saying it did that?

j-james · 2 years ago
It will not emit warnings saying it did that. The static analysis is not very transparent. (If you can get the right incantation of flags working to do so and it works, let me know! The last time I did that it was quite bugged.)

Writing an equivalent program is a bit weird because: 1) Nim does not distinguish between owned and borrowed types in the parameters (except wrt. lent which is bugged and only for optimizations), 2) Nim copies all structures smaller than $THRESHOLD regardless (the threshold is only slightly larger than a pointer but definitely includes all integer types - it's somewhere in the manual) and 3) similarly, not having a way to explicitly return borrows cuts out much of the complexity of lifetimes regardless, since it'll just fall back on reference counting. The TL;DR here though is no, unless I'm mistaken, Nim will fall back on reference counting here (were points 1 and 2 changed).

For clarity as to Nim's memory model: it can be thought of as ownership-optimized reference counting. It's basically the same model as Koka (a research language from Microsoft). If you want to learn more about it, because it is very neat and an exceptionally good tradeoff between performance/ease of use/determinism IMO, I would suggest reading the papers on Perseus as the Nim implementation is not very well-documented. (IIRC the main difference between Koka and Nim's implementation is that Nim frees at the end of scope while Koka frees at the point of last use.)

j-james commented on Bluesky announces data federation for self hosters   bsky.social/about/blog/02... · Posted by u/jakebsky
steveklabnik · 2 years ago
I hear you on some level. That said, we are already seeing people creating blocklists, and tools to share them with others. That is happening alongside the company's investment in paying people to work on T&S related issues on their instance.

I am not sure if it will succeed or fail, but I am interested to see how it plays out.

j-james · 2 years ago
That relies upon the benevolence of corporations to much more of an extent than I am comfortable with. 20 years of social media has convinced me that that's a bad idea. And, I think, it removes much of the benefits of federation: if the only way to sustainably moderate is to rely upon gifts from BlueSky Inc., moderation is going to be necessarily dependent upon them.
j-james commented on Bluesky announces data federation for self hosters   bsky.social/about/blog/02... · Posted by u/jakebsky
steveklabnik · 2 years ago
> I'm especially curious to learn about the moderation layer in-depth.

You'll want to read:

* "Composable Moderation," this is the core conceptual idea: https://bsky.social/about/blog/4-13-2023-moderation

* "Moderation in a Public Commons," which describes specific features that were added in pursuit of the previously-described goal https://bsky.social/about/blog/6-23-2023-moderation-proposal...

* "Bluesky 2023 Moderation Report," which discusses specifically how (what is now) the main instance was moderated last year https://bsky.social/about/blog/01-16-2024-moderation-2023

j-james · 2 years ago
I cannot see how BlueSky's moderation system can ever work. Decoupling moderation and hosting means there's no onus to do the moderation that they describe: which makes me think it will be BlueSky Inc., and only other corporations, that have resources to throw employees at a now thankless, Facebook-style moderation job. And instances have to moderate anyway, in order to not host illegal content.
frigid commented on C23: A Slightly Better C   lemire.me/blog/2024/01/21... · Posted by u/mfiguiere
winrid · 2 years ago
Nim [0][1], but will obviously evolve in 10 years. Even Java will likely deprecate some things in that time... Nim allows importing C/C++ OOTB.

[0] https://livebook.manning.com/book/nim-in-action/chapter-8/60

[1] https://github.com/nimterop/nimterop

frigid · 2 years ago
You don't want nimterop, you want futhark (https://github.com/PMunch/futhark).

The C FFI Nim library lineage goes c2nim --> nimterop --> something i forgot --> futhark.

j-james commented on OpenD, a D language fork that is open to your contributions   dpldocs.info/this-week-in... · Posted by u/mepian
dom96 · 2 years ago
It's no big reveal that I was involved and optimistic about Nim for a long time, though "BDFL-in-2nd-command" is a stretch for someone who couldn't even get the community to instate a Code of Conduct. That's one of the many many reasons I left.

My many years of involvement with Nim is what I believe qualifies me to speak on the individuals in the forked project. That being said, I am no longer involved with Nim. I don't want to get reinvolved. I just want to warn people about individuals who were abusive to me (and others) for many years.

I banned very few people during my time in the Nim community, and never without good reason. I don't know who you could be referring to here. I'm sure you left this comment with the best of intentions, but you say it yourself, you were less active back then and have had minimal interactions with me on the subject.

j-james · 2 years ago
Ah, I was referring to disruptek. I don't know why you two hated each other's guts, mostly due to being less active back then indeed. For what it's worth I didn't think the banning was undeserved: but the interactions you two had always struck me as strangely animus, and not anything like anything I've ever seen between him and anybody else, and certainly not between any other nimskull developers and anyone, ever.

It is perhaps notable that the nimskull project has a Code of Conduct (and a rather good one at that). I think it is indicative of serious intention to make a welcoming community, and I don't think that contributing members having had in the past what really struck me as personal grievances turning into open-air malice undermines that: particularly, such behavior would fall under the Code of Conduct itself. But again, I have not seen such behavior - quite the opposite! - outside of what happened between you two.

j-james commented on OpenD, a D language fork that is open to your contributions   dpldocs.info/this-week-in... · Posted by u/mepian
dom96 · 2 years ago
Take it from me: I disagree with the BDFL of Nim about a lot, but him banning some of the people who are behind this fork was one of the best decisions he’s made. Stay far away.
j-james · 2 years ago
Some context: dom96 here was the BDFL-in-2nd-command of Nim for quite some time. There is personal beef between dom96 and some of the primary nimskull contributors, which mostly involved a lot of name-calling, personal insults, and critiques of leadership and leadership effectiveness, that eventually lead to dom96 banning one of the aforementioned contributors, stalling quite a lot of interesting compiler work and partially sparking nimskull. It's all quite boring stuff.

dom96 eventually had a falling out with the Nim BDFL too (which I'm surprised did not happen earlier: the BDFL is... brusque, charitably) and so has been inactive in either Nim community because, well, obviously. But: in all my years involved with Nim, I have seen the nimskull developers to be pretty consistently great to work with? I think they handle things professionally, are not rude, and treat other's work with care (you will maybe notice they have a code of conduct exposing an explicit intent to do so). Which makes what happened between them and dom96 all the stranger in my eyes, but I was less active back then, and there is certainly context I am missing.

tl;dr meh

j-james commented on Converting the Kernel to C++   lore.kernel.org/lkml/3465... · Posted by u/artagnon
LorenDB · 2 years ago
It's pretty much familiarity. If I'd learned Rust back in the day, I'd probably not want to learn C++ for syntax reasons as well.

One thing I think Rust gets wrong is classes. I absolutely don't understand why you would require a separate `impl` block to provide methods. C++ has a reasonable syntax of providing methods in the class.

j-james · 2 years ago
Well, they're not classes, they're interfaces, and so you can implement multiple interfaces for multiple types, and so you have to implement them separately from the type declaration. There's not too much of a way around that, I think.

Deleted Comment

u/j-james

KarmaCake day1132November 30, 2019View Original