๐พ Archived View for bbs.geminispace.org โบ u โบ clseibold โบ 21235 captured on 2024-12-17 at 15:55:08. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Re: "Trying out odin language"
Odin is very much influenced by Golang (and Pascal), according to its creator. The for loops that you see are becoming more and more common in new languages, like Golang, Odin, (JAI), and Rust. You can still do the traditional for loops in all of these languages, btw: `for i := 0; i < 12; i++ {`. But using ranges often makes things more readable and it's just simpler and more intuitive to write and read. One thing Odin has over Golang is it lets you use ranges backwards too, iirc, which I quite like.
Odin's biggest flaw right now is a lack of a TLS library (last time I checked, at least). Other than that, it's like a much better Golang with no GC, imo. I also really like how it handles memory allocators. And the way it handles strings is amazing, although it takes a little bit to get used to, as a string type is just a u8 slice. It's not totally dissimilar to Golang. Very different from C's crappy strings thuogh.
Zig's for loops are what I would call weird (as hell, lol). But zig also has something kinda like ranges, I think.
Oct 25 ยท 8 weeks ago
๐ LucasMW [OP] ยท Oct 25 at 21:36:
It is not the for loop with ranges that I find weird, but the lack of while(condition). I was forced to do for { if (!condition) break }} which I find very counter intuitive.
But maybe that's my mistake and there is another way to do while loops that I missed?
I wish I could try jai, but I believe I lost the opportunity to join the compiler beta list.
๐ clseibold ยท Oct 25 at 21:39:
Oh, gotcha! Yeah, Golang also lets you do `for {` with no expression, and it acts like a while loop. I think the idea is if we have that, then we don't need a separate keyword `while` that does the exact same. But yeah, that is an interesting choice, but you get used to it. For loops are just while loops with a variable counter, tbh. If you take away the variable initializer and the variable incrementer from a for loop, you literally get a while loop.
Note that Odin does have `do { } while` loops for those who use them (I don't like do... while loops).
๐ LucasMW [OP] ยท Oct 25 at 22:04:
By the way, Do you know a good devtool for odin? I use sublime text, (odin creator also seems to use it), but I still haven't find how to configure it to have decent autocomplete (showing me all functions of said import) or how to "go to definition" of functions from core and vendor libraries. I wish I had these both
๐ clseibold ยท Oct 25 at 22:14:
@LucasMW Yeah, there's ols (Odin Language Server), but I don't know if it supports sublime. I know it supports VSCode and you can get it on the new Zed text editor too (https://zed.dev). You can find ols here:
If you are using VSCode or Zed, then just download the Odin extension for the respective text editor, and ols will be downloaded by those extensions.
Trying out odin language โ Doing some experiments with odin and raylib It is small demo of a bf runner, coupled together with some audio shaders demo I found on the web that I used as a starting point. I expected being able to share some pictures of it here, but I will be fighting de 100kb limits to post something nice to look at. odin has an structure that I find many different from what I am used to, specially in loops [preformatted] It is weird to me. Coming with raylib, miniaudio and...
๐ฌ 5 comments ยท 1 like ยท Oct 25 ยท 8 weeks ago ยท #odin #programming