Live data from Hacker News

Odin, a pragmatic C alternative with a Go flavour

bitshifters.cc

111–120 of 131 posts

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

#111

For me, I don't really look at Odin as a successor/fixer of C. There are other languages that can make a better case for that[1][2]. Instead, I look at it more like a successor/fixer of Pascal. It doesn't fall down the OO hole that so many others did. It has type casting, dynamic arrays, parametric polymorphism in both functions and data structures, is much less noisy (and in my opinion far more skimmable), more usef…

I checked out bcrypt implementation in Hare, and I saw "errors::invalid" being used. It was not specified. What if I want to have more errors and in the documentation I want people to know which errors, say, my library may return from specific functions?

C3 had some weird stuff going on at some places, not exactly sure why. In my other thread someone else already went into it in more detail. I hope the developer will fix it. Needs to stay as close to C as possible and build on top of it, only some of the goodies.

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

#112

For me, I don't really look at Odin as a successor/fixer of C. There are other languages that can make a better case for that[1][2]. Instead, I look at it more like a successor/fixer of Pascal. It doesn't fall down the OO hole that so many others did. It has type casting, dynamic arrays, parametric polymorphism in both functions and data structures, is much less noisy (and in my opinion far more skimmable), more usef…

Thank you for the kind words regarding Odin! So Odin is in the family of Pascal _but_ I've tried my best to design it in such a way that it does "fix" most of the problems of C (since I am/was a C programmer), and make it _feel_ good to a C programmer when programming in the language. My view is that the core of Pascal was actually the correct place to start rather than the core of C. C won out of Pascal purely becau…

What exactly is "distinct" in Odin, and what is it used for, and from where did you get this from?

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

#113
post #74

Earlier quoted context omitted.

Thank you for the kind words regarding Odin! So Odin is in the family of Pascal _but_ I've tried my best to design it in such a way that it does "fix" most of the problems of C (since I am/was a C programmer), and make it _feel_ good to a C programmer when programming in the language. My view is that the core of Pascal was actually the correct place to start rather than the core of C. C won out of Pascal purely becau…

Where can I follow Odin's progress other than the blog? It doesn't seems to have any social media presence. And what sort of time frame in terms of 1.0? I found Odin lacks the marketing push from Zig or Rust.

They have a Discord server.

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

#114
post #24

Earlier quoted context omitted.

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

Doesn't having a whole subset of the language called "Better C" qualify?

It has been a while since I dived into the land of Dlang.

To me, and originally, Dlang was a C++ replacement. However, C and C++ can still be rather mixed despite them being "two different languages"

In my words, BetterC is a tool to help you transition a C programming project to a Dlang one. Turn on the BetterC flag and the transition is quite mild. The goal is to slowly migrate your (now) D code into "proper" D. Then, you can turn off the BetterC flag.

That.. to me.. is the original goal of BetterC. However, I noticed that BetterC has become rather popular in the D community to simply write programs with the GC disabled. There is a slight divide/debate in the community of what D should be.

I remember trying the full features of D and slowly moving to coding in BetterC to.. eventually.. moving away to another language.

Why?

As much as like Dlang - it tries to be everything. By default it is an OOP, GC language. However, it has functional support, BetterC, as well as (dip1000) Borrow Checker, and others. In the end you end up with programs written in D in various ways. Imagine when using the package manager. You can search for packages.. but how are they implemented? Is it using the GC? Will it work on the latest version o D? So many questions. You end up looking at the code yourself to determine if the library is going to do what you want.

I am not sure if D is a "C++ replacement" today. It tries to compete with orther, modern languages like Rust or Go and others would prefer it to be a C# or Java competitor.

This is why I like Odin. It makes it very clear what it is and isn't. Sure this means that Odin in various ways will have less features than D but atleast I know the code is simpler, and when taking on other Odin projects I know it still follows the same format.

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

#115
post #83
post #23

Earlier quoted context omitted.

Seems needlessly harsh and also misplaced in some way. Zig is super non-ergonomic to any C-developer, and its explicitness at all costs is also non-C-like (meaning a rather big shift for someone actually liking C). Rust is a completely different beast altogether. Odin is a rather simple, performant, pragmatic, procedural language, fixing especially things in C with regards to its type system and infrastructure (such…

I have long been aware of that particular user of Odin, after all the creators mention it frequently. The fact remains that the US government has warned against the use of languages such as Odin [1]. As such, it is competing in the extremely small niche of "languages best suited for embedded computing and operating systems". Suffice to say that most of its users likely do not use it for that. Finally there is the mat…

Just curious - which Odin talk are you referring to that shows it as "directionless anf filled with fluff"

Also the company logos on the website are under "Companies who use products by JangaFX" but it probably should be in its own section.

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

#116

re Odin -- I do not like reusing important names in this way. Can I be the only one?

Person A: "Odin"

Person B: Has panic attack. Which Odin are we referring to?

--

Person A: "Python"

Person B: Has panic attack. Which Python are we referring to?

(You are the only one)

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

#117
post #27

Earlier quoted context omitted.

Once, on a previous account, he actually replied to me. It's like a kid going to guitar center and the guy who replaces your strings is Axl Rose. If you're on here, Walter, you're my hero. I also once interacted with Brendan Eich, who I admire as much for his role in web history as for his activism.

[flagged]

context: https://slate.com/human-interest/2014/04/brendan-eich-suppor...

He has never given an update, and I don't believe his views have changed.

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

#118
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 :(

You're not kidding, I knew they were here, but the amount of effort on this is pretty subpar. cc: @dang

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

#119
post #83
post #23

Earlier quoted context omitted.

Seems needlessly harsh and also misplaced in some way. Zig is super non-ergonomic to any C-developer, and its explicitness at all costs is also non-C-like (meaning a rather big shift for someone actually liking C). Rust is a completely different beast altogether. Odin is a rather simple, performant, pragmatic, procedural language, fixing especially things in C with regards to its type system and infrastructure (such…

I have long been aware of that particular user of Odin, after all the creators mention it frequently. The fact remains that the US government has warned against the use of languages such as Odin [1]. As such, it is competing in the extremely small niche of "languages best suited for embedded computing and operating systems". Suffice to say that most of its users likely do not use it for that. Finally there is the mat…

> The fact remains that the US government has warned against the use of languages such as Odin

That goes for Zig as well. But, the NSA is only classifying based on most well-known languages, and additionally a lot of those aren't 'memory-safe' they just have GC, the reason they don't believe you should use C is because they don't have built in memory safety checks at all, whereas Odin does. They have Pascal on that list, which is a primary inspiration of Odin, and is also technically an unsafe language.

> By contrast the Odin presentation I saw was utterly directionless and filled with fluff.

I am not sure why a presentation has anything to do with performance or credibility of a language, plus I am always impressed by their talks. Good chance you saw their live coding/development sessions? They live stream development fairly often.

> I like to think I have a good nose for BS, and Odin trips it.

Odin is used in production, hard production today. I use it to run 6000+ retail locations doing embedded automation work in security, it's highly proficient and accessible. There is no BS here, everything has been defined and they are honest about their shortcomings when there are those (which are minimal).

> The Zig compile supports multiple codegen backends, compiling C/C++ code, and easy cross-compilation.

That's because they bundle the entirety of LLVM in their builds, they didn't do a lot of extra work for C/C++ code compilation, they just built an alias (with a set of internally defined better default flags) to the clang compiler, it's just a passthrough.

re: cross-comp: Odin is in the same boat, both Zig and Odin compile out to assembly via LLVM, they can reach the same targets practically.

> That great wall of random corporate logos of companies which don't use Odin on their website doesn't help

They do use Odin, they use JangaFX, that is less a 'this is a code written by these companies' (which some do send upstream changes, so they do) and more of a declaration of "We are used in production in these companies, you have likely ran Odin code in your favorite games, or seen in your favorite movies". That's fairly obvious for any tech-oriented project or company, especially for a language.

> Additionally, I don't think a C replacement should be immediately intuitive to someone who has only ever used C

Again, automation systems architect for one of the largest companies in the world here, I have people who have never even _programmed_ writing proficient code to use in production (after checks, of course). As an embedded developer, its insanely intuitive to C developers, and anyone who has ever programmed.

---

Check out the language, write some code, try it out, seriously, I was on the fence when I first heard about it several years ago, I think you might enjoy it. If you're not an LLM chatbot, then you might even find it invigorating to try something new. Doesn't hurt, and you learn some new things.

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

#120
post #28

I like odin a lot, however, there are two things that just don't stick with me, and i ended up quitting: - RTTI: just give me compile time type introspection and let me disable RTTI without making the language unusable - when/import: just let me wrap an import inside a when block, being forced to split my file in 3 made me quit the language

Can't comment on RTTI, but lack of conditional imports are indeed an annoyance but I'm willing to put up with it because of all the other niceties in the language.

You technically _can_ do conditional imports by mis(?)using the #load('') usage, its not perfect and might not work for all cases, but it can be done since #load() loads a file/entity in at compile time. It's a 'hack' but it can be used that way.

Edit: This thread is useful: https://forum.odin-lang.org/t/conditional-imports/497/2

Post reply on HN