News for hackers. Stuff that matters.

noodledoodletwo

Re:How I Built Zig-SQLite on Saturday May 28, 2022 @07:29AM (#31539471)
I recommend trying it again. Consider how old the language is, 7 years is a really long time ago.

It may not be the smallest language, but, it compiles pretty tightly.

Re:How I Built Zig-SQLite on Saturday May 28, 2022 @07:23AM (#31539438)
The productivity cost is mostly up front, once you understand borrowing it's seriously not bad in 99% of cases. Also, you can be initially productive in C or C++, but how much time goes into trying to fix undefined behavior, threading issues,etc. More importantly, when do those hours get spent? Is it after a customer is screaming into your support chatbot, or is it before you launch during normal development? To me that's the difference and the killer feature. That's why ms, aws, etc are using it. Not because it's new and marginally/debatably better then c/c++.

Once I started realizing what the borrow checker was saying it wasn't "fighting the compiler" I realized what I was asking the compiler to do was really not a good idea. It becomes your friend basically.

I didn't make this post to shill rust, I'm pretty language agnostic to my own detriment... The point is, it's worth considering and trying it again if you didn't get it the first time around. Rust took me 2x to become a tool I'd use, I honestly hated it at first.

Re:How I Built Zig-SQLite on Saturday May 28, 2022 @07:11AM (#31539371)
I actually disagree with that and think it encourages bad practices in people who don't know better. The rise of fuzz testing on these old c applications following this kind of mentality is a constant source of cves . Why expose users to problems, if it's easy not too?

Also it's not like that safety costs much of anything. You really can get comfortable writing rust, especially "easy rust" like a single thread cli app. It really is easy, even convenient.

Either zig is a different tool to rust, in which case I get it. Or people should be waiting for zig to be mature, meanwhile rust has been stable for half a decade, and at this point "just works". I'm not going to sit through an addendum static analyzer and all the bugs that come with making one for a few years. Other people whose appetite for risk is higher will though, and I wish them the best. I've seen efforts in other languages, my conclusion is that it's much better to have it built in...

Re:How I Built Zig-SQLite on Friday May 27, 2022 @01:19PM (#31532145)
I'll believe it when I see it hit 1.0 and has a healthy user base.
Re:How I Built Zig-SQLite on Friday May 27, 2022 @01:18PM (#31532136)
It's really not that hard to use once you invest some time into it. I know where you are coming from, but appeasing the compiler actually means "I am writing safe code". Rather then "it compiled let's see what happens in production"
Re:How I Built Zig-SQLite on Friday May 27, 2022 @01:13PM (#31532063)
What environment cannot run C?
Re:How I Built Zig-SQLite on Friday May 27, 2022 @11:06AM (#31530470)
Thanks for explaining, I really appreciate it.
Re:How I Built Zig-SQLite on Friday May 27, 2022 @11:05AM (#31530459)
Yea but for the most part you can avoid macros, and areas where you can't you can consider them to be keywords in my opinion anyways. Macros aren't all bad, but they do get abused a lot and make a nightmare for others. Fwiw Ive only written one macro and it was for learning purposes only.
Re:How I Built Zig-SQLite on Friday May 27, 2022 @09:57AM (#31529707)
Fair enough thanks for explaining. Basically if you want to make your own Malloc or things like it, zig is friendlier. Will say though, I've used rust for gamedev, and found the experience to be really nice. Was I writing my own memcpy though, nope.

It's funny how in rust you can write raw asm, but there seem to be quirks somewhere in the middle.

Re:How I Built Zig-SQLite on Friday May 27, 2022 @09:34AM (#31529445)
See I got downvoted a bit... Let me rephrase, other modern languages offer something along the lines of these, of the things that aren't there for say rust, close integration with c/c++ is nice. Ie rust has nostd, etc.
Re:How I Built Zig-SQLite on Friday May 27, 2022 @09:03AM (#31529119)
Does a really short summary of this read kind of like, "zig is a modern c, but I like using rust as a modern c++"?

Agree, Tokio is a little tricky for people new to rust no doubt, but it's tricky for a reason. It's saving lives in production.

Re:How I Built Zig-SQLite on Friday May 27, 2022 @08:44AM (#31528914)
I see where you are coming from, zig is easier to learn, but zig doesn't offer what rust does with respect to safety. That feature is so hard for me to ignore. I respect it though, some people want to be up and running with a new technology in a day or whatever, rust doesn't give you that unless you are very seasoned.
Re:How I Built Zig-SQLite on Friday May 27, 2022 @08:40AM (#31528873)
D nim and a few others offer nicer syntax over what's normally C for sure. Yea it doesn't surprise me that an established product had trouble incorporating rust, but at the same time, there's a reason why they went through with it right? Memory safety, no data races, etc. Like there is a motivating reason for using it. Meanwhile lots of other products have found ways of integrating Rust and some of them are risk averse products.
Re:How I Built Zig-SQLite on Friday May 27, 2022 @08:38AM (#31528850)
Yea I feel like most of these differentiators aren't things most people care about barring one. Tight integrations with c/c++ is potentially useful, beyond that I don't really get it. It's kind of like Hare in that regard?
Re:How I Built Zig-SQLite on Friday May 27, 2022 @08:04AM (#31528539)
Cool article.

I can't figure out why i am supposed to care about zig beyond it's fun? I get that it's interesting and more safe than C (honestly though what the hell isn 't).

Say you write rust pretty regularly for new product development, what does zig offer to make my life better, my products more stable, etc?

Re:Secure Rust Guidelines on Tuesday May 17, 2022 @07:44AM (#31409025)
I agree with you all. Bake it into clippy or make a different clippy aka seclippy. Also, I appreciate the docs so I understand why with examples. Also make a attribute that blocks some of these things