News for hackers. Stuff that matters.
Re:I like Odin by samatman on Sunday August 28, 2022 @01:17PM (#32630046)
I don't think any feature should be a mandatory part of a programming language, provided its reasons for not including it make sense. I'm fuzzy on Odin, if you showed me some Odin and some Hare I bet I couldn't tell them apart, but it kinda looks like a nice C with syntax inspiration from Go and (hence) Pascal.

A language like that, as long as the object code is correct, then hey, it's there for people who want it.

I think Zig, which I understand better but don't use, has a good reason for not building in RAII. Zig has a "no allocation without an allocator" rule, and what's easiest to describe as native valgrind. It also has comptime, and RAII loses some conceptual simplicity when you start doing transformations between what-you-see and what-you-get.

I think it's worth continuing to explore whether that's a sufficient approach to memory safety, rather than doing something which has already been done, prematurely. I happen to think it's a promising approach, favoring clarity and simplicity.

We'll see. Zig can always add RAII later, and so can Odin. But at most once each, so it pays not to be hasty.

Re:I like Odin by gingerBill on Sunday August 28, 2022 @01:53PM (#32630387)
Regarding Odin and Hare, I'd argue most people would easily be able to tell them apart from the syntax alone because the declaration syntaxes are quite different. And most people judge a syntax pretty much solely by the declaration syntax itself.

Regarding RAII, I explain in another comment (https://news.ycombinator.com/item?id=32629951) the issues with RAII and what it requires to be useful. Odin has the similar rule of "no allocation without an allocator" but has the implicit `context` system which passes the current context's allocators around. Odin also has core library support for valgrind, callgrind, memcheck, and soon helgrind.

Odin has features (which this article does showcase) which are akin to RAII but are not attached to the type system. And as I explained in the previous comment, RAII wouldn't even make much sense in Odin (or Zig for that matter) and would probably never a good idea to add it later. There are better alternatives to RAII for languages such as Odin and Zig.

Re:I like Odin by samatman on Sunday August 28, 2022 @02:04PM (#32630487)
Hi Bill, wasn't intended as a criticism of either, or as an observation about the syntax choices, but rather as a way of saying how familiar I am with both: I could say some things about them which are accurate, but not tell code samples apart.

RAII isn't something I happen to be looking for in a language, it kind of falls between Rust and your work in a way that I don't have a use for.

It's an interesting domain, isn't it? You'll always have people reacting from the hip to the problems C has given us, but they'll be back a couple hours later to talk about the wonders of SQLite.

SQLite got there by being careful and building tools to keep them out of trouble. I see an important role for languages which build those tools in, but don't try to replace a manual transmission with an automatic.

Re:I like Odin by gingerBill on Sunday August 28, 2022 @02:17PM (#32630603)
I never took it as a criticism, rather a clarification for others and to explain how Odin does things.

And it is indeed an interesting domain. Something to be very careful before making rash opinions on too. It is such an unexplored field so much potential!