Live data from Hacker News

Odin, a pragmatic C alternative with a Go flavour

bitshifters.cc

101–110 of 131 posts

Re: Odin, a pragmatic C alternative with a Go flavour

#101
post #29
post #24

Earlier quoted context omitted.

D was never a C alternative, it was a C++ alternative.

^ and this person (no affiliation) has a much "truer" C alternative in the making, just for everyone's information: https://c3-lang.org/ Haven't gotten around to trying it out, but skimmed the documents a lot at one point. Always try to keep tabs on it, doesn't get the love it should.

Yeah, I have used Odin before, I am thinking of giving C3 a try as well.

At a quick glance though:

> Enum support various reflection properties: .values returns an array with all enums. .len or .elements returns the number of enum values, .inner returns the storage type. .names returns an array with the names of all enums. .associated returns an array of the typeids of the associated values for the enum.

I do not like that the length is named ".elements" instead of just ".len". And why are there two ways, or are they not the same? Etc.

Re: Odin, a pragmatic C alternative with a Go flavour

#102

Earlier quoted context omitted.

I'm kinda curious, you mind sharing some of the things you thought you didn't like?

I took a good hard look at everywhere I may have stored it, but I believe I lost the original list after formatting. I remember believing these were important: - methods (turned out I mainly wanted working intellisense, which Odin does even without methods) - a package manager (still a gripe, but git submodules do the trick somewhat) - expressions (so I could assign the result from a `switch` statement to a variable…

I do not like "@require_results", for example. Ada uses function vs procedure to make the distinction. I would rather have something like that.

Re: Odin, a pragmatic C alternative with a Go flavour

#103
post #29

Earlier quoted context omitted.

^ and this person (no affiliation) has a much "truer" C alternative in the making, just for everyone's information: https://c3-lang.org/ Haven't gotten around to trying it out, but skimmed the documents a lot at one point. Always try to keep tabs on it, doesn't get the love it should.

Yeah, I have used Odin before, I am thinking of giving C3 a try as well. At a quick glance though: > Enum support various reflection properties: .values returns an array with all enums. .len or .elements returns the number of enum values, .inner returns the storage type. .names returns an array with the names of all enums. .associated returns an array of the typeids of the associated values for the enum. I do not lik…

FWIW I have spent the weekend testing out C-replacement languages and their interop (linking to libsdl3 and libtcl) with D, Go, Rust, Odin and C3. My quick impressions:

- D is featureful, but too much so. It feels an unfocused kitchen sink worse than C++. Overall the actual dev experience was nice.

- Go I know pretty well, but saddened that CGo is very slow, so I cannot consider it truly a C replacement

- Rust I also know decently well, but writing types and lifetimes isn’t my idea of fun. I’d rather have less safety when playing with code, I’m not always writing mission critical apps. Overall walks the fine line between excellent and unergonomic; pulls half a gig of dependencies just to include SDL3 which is pure madness.

- Odin I have played with before, excellent for the gamedev world, but some features seems like they have been added just because the author liked them. Having to explicitly set up the context variable in cdecl callbacks feels bad. I dislike the whole context thing actually, because it is rigid though convenient.

- C3: documentation is bad but feels the closest to a better C. Still in the breaking phase, I sent a PR this morning to adapt the SDL3 library to the latest release. Has macros which I haven’t tested but it’s a big plus. Some syntax makes no sense, like block labels and generic in {braces} but it’s the one I will keep playing with for this project. No one seems to use or know about it, which doesn’t bode well for its future.

- Zig I haven’t used this weekend, I loathe that unused variables are errors and it is very verbose. Docs and stdlib are way undercooked. comptime is a brilliant idea. Could be decent past 1.0 release.

- Jai: I’d love to try it, if I had access to the beta.

A lot of paper cuts and small issues, nothing is really worthy of being called a C replacement, but I do not want to write another header file again so these will make do for now.

Re: Odin, a pragmatic C alternative with a Go flavour

#104
post #103

Earlier quoted context omitted.

Yeah, I have used Odin before, I am thinking of giving C3 a try as well. At a quick glance though: > Enum support various reflection properties: .values returns an array with all enums. .len or .elements returns the number of enum values, .inner returns the storage type. .names returns an array with the names of all enums. .associated returns an array of the typeids of the associated values for the enum. I do not lik…

FWIW I have spent the weekend testing out C-replacement languages and their interop (linking to libsdl3 and libtcl) with D, Go, Rust, Odin and C3. My quick impressions: - D is featureful, but too much so. It feels an unfocused kitchen sink worse than C++. Overall the actual dev experience was nice. - Go I know pretty well, but saddened that CGo is very slow, so I cannot consider it truly a C replacement - Rust I also…

Thanks for sharing! I think there is hope for C3, if they do not mind breaking backwards compatibility, which I hope they do not, for now!

We have similar experiences I would say. I do like Go a lot, but I rarely had to touch CGo though. The language does not get in the way of being productive. Rust seems like it does.

I would give Jai a try, too!

Have you tried Zig, or perhaps even Nim? Curious about your thoughts.

Re: Odin, a pragmatic C alternative with a Go flavour

#105
post #103

Earlier quoted context omitted.

FWIW I have spent the weekend testing out C-replacement languages and their interop (linking to libsdl3 and libtcl) with D, Go, Rust, Odin and C3. My quick impressions: - D is featureful, but too much so. It feels an unfocused kitchen sink worse than C++. Overall the actual dev experience was nice. - Go I know pretty well, but saddened that CGo is very slow, so I cannot consider it truly a C replacement - Rust I also…

Thanks for sharing! I think there is hope for C3, if they do not mind breaking backwards compatibility, which I hope they do not, for now! We have similar experiences I would say. I do like Go a lot, but I rarely had to touch CGo though. The language does not get in the way of being productive. Rust seems like it does. I would give Jai a try, too! Have you tried Zig, or perhaps even Nim? Curious about your thoughts.

Added my comments about Zig.

Nim I played a bit with, I don’t really like the syntax but I admit I need to dive deeper. My other issue is that it is so different syntax wise to C, and sometimes so high-level, it’s hard to tell what construct is efficient, and what allocates and takes 500 instructions to run. This is pretty crucial for a low level system language.

Re: Odin, a pragmatic C alternative with a Go flavour

#108
post #16

Odin seems to strike a really interesting balance between simplicity and practicality, especially for game development. I like the idea of having “batteries included” without too much abstraction getting in the way. For those who have used both Odin and Go, how do you feel about the differences in day-to-day development? Are there any features in Odin that you wish Go had, or vice versa? Would love to hear more real-…

I'd recommend going through https://odin-lang.org/docs/overview , as most of my points will be directly from there. Keep in mind it doesn't show _every_ feature (for instance, there are more built-in comptime procedures than shown https://odin-lang.org/docs/overview/#built-in-procedures-1 ), but does do a good job at displaying most. Odin has all the features Go has (even struct tags https://odin-lang.org/docs/overvi…

Just to note: you're responding to a chat bot. Your comment is such a contrast to the level of effort that the parent poster put into theirs :(

Re: Odin, a pragmatic C alternative with a Go flavour

#109
post #108

Earlier quoted context omitted.

I'd recommend going through https://odin-lang.org/docs/overview , as most of my points will be directly from there. Keep in mind it doesn't show _every_ feature (for instance, there are more built-in comptime procedures than shown https://odin-lang.org/docs/overview/#built-in-procedures-1 ), but does do a good job at displaying most. Odin has all the features Go has (even struct tags https://odin-lang.org/docs/overvi…

Just to note: you're responding to a chat bot. Your comment is such a contrast to the level of effort that the parent poster put into theirs :(

All good, I contribute for everyone reading ^_^
Post reply on HN