5 ms·
Introduction to the Odin Programming Language
- donlzx 2y agoI like the Odin language because it is really joyful to programming with it. Hope there are more resources and mature packages besides gaming development.
- CyberDildonics 2y agoWhat is joyful about programming it?
- Sparkyte 2y agoThe advertisement on Y Combinator.
- eterps 2y agoIn my opinion, Odin is the most Pascal-like language with C-like syntax.
- Rochus 2y agoWhy not directly use a modern Pascal? What's the advantage of Odin in this respect (besides the C-like syntax)?
- bobajeff 2y agoLike what? The only one I can think of is Ada.
- Rochus 2y agoFreePascal, Delphi, Oxygene, Oberon+
- masfoobar 2y agoWhile it has been a number of years since I last used Pascal (Delphi 5 or Turbo Pascal before that) -- I do like the language but I find the code syntax to be bloated at times. Maybe better to say harder on the eye when looking at large source code compared to C. Of course - modern Pascal (Free Pascal, Delphi, etc) might have evolved a lot since. // C void some_func(int a) { int b = a + 10; printf("hello %d\n", b); } { Pascal - Going by memory, so might be a tad wrong } procedure SomeFunc(a : Integer) var b : Integer; begin b := a + 10; WriteLn('hello ', b); end; I have been playing around with Odin for a little while, now. It may have been inspired by Pascal in a number of ways but it certainly isn't as cumbersome to write. I am liking the syntax much more. // Odin some_func :: proc(a : i32) { b := a + 10 fmt.println("hello ", b) }
- techn00 2y agoThe syntax looks very similar to Go
- thomascgalvin 2y agoThere are only so many ways to write "C, but better," or "C++, with fewer warts." Any languages that want to be recognizable to people comfortable with the C-lineage are going to converge on a lot of points.
- desdenova 2y agoAnd some of the bad ideas are also there.
- lostdog 2y agoLike what? I'm seeing that the Union is by-type and not by-name (such as C vs Rust enums). I didn't see good support for preventing null pointers, but maybe I missed that. And it wasn't clear if RAII works.
- metaltyphoon 2y agoZero values is just bad
- Lyngbakr 2y ago> If you want to use one of Odin or Zig but don’t know which one, then I recommend spending 1-2 weeks using each and then make up your own mind. That's fair enough, but has anyone who has done this got any thoughts? Zig seems to have a lot of admirers on HN. Is Odin on par with Zig?
- desdenova 2y agoJust by reading this introduction, Zig seems like a much better designed language so far. Odin inherits a lot of warts from horrible languages like Go, and they seem to have run out of ideas to solve some problems at some point.
- forrestthewoods 2y agoCan you be more specific? What do you like about Zig? What warts does Odin inherit?
- metaltyphoon 2y agoI don’t think zero values is a good idea on Odin. In Zig, anytype will be a mistake.
- cardanome 2y ago> Odin inherits a lot of warts from horrible languages like Go Still waiting on you to list what those "warts" may be. I mean sure golang may be overly conservative in its design but calling it "horrible" is a very wild take. The only evil I know of that golang has perpetuated is making an unused-variable error an compile error that will block compilation instead of an linter error. This makes prototyping much more annoying. Ironically a design mistake that Zig has copied as well. Not sure if Odin does actually
- sarchertech 2y agoI investigated both for a side project. I ended up going with Odin. Primarily because despite them both being non-GC languages, Odin felt higher level to program in. Also Odin has official Direct3D and Metal support.
- sidkshatriya 2y ago(Syntax is not as important as the intrinsic attributes of a language) Why Odin -- Can someone tell me ?
- diggan 2y agoOdin website sure could! Highlights according to landing page: > Data-Oriented, Simplicity, High Performance, "Batteries Included", Open Source (BSD 3) https://odin-lang.org/ https://odin-lang.org/
- rerdavies 2y agoThe FAQ hides an excellent description of the philosophy of Odin, once you get past the first couple of FAQ entries. https://odin-lang.org/docs/faq/ https://odin-lang.org/docs/faq/ A shame that it isn't broken out into an explicity "Why Odin" page.
- fuzztester 2y ago>A shame that it isn't broken out into an explicity "Why Odin" page. This make me think that every programming language web site should have a Why $language page, either as the home page, or prominently linked from it.
- fuzztester 2y agoThe same for every other type of software's web site, of course.
- jakjak123 2y agoThis looks so much like Golang, weird to not mention it
- oldpersonintx 2y ago[dead]
- Sparkyte 2y agoAnother one to collect dust. The problem I run into with new languages are the often dissolving community when they first gain popularity and then run into a critical design flaw. How is a person who goes about learning a language to find extendability of a language if it never gets out of the early-alpha stage and has more than 5k followers?
- diggan 2y agoSeems EmberGen (and all products JangaFX produces) are made with Odin, so one can be fairly confident it won't disappear over night. I'd probably consider Odin production ready already since EmberGen works pretty well for its use cases, and is blazing fast.
- James_K 2y ago[flagged]
- toastercat 2y agoSame, except I read him say he prefers pineapple on pizza. After reading that, I knew Odin was no good.
- szvsw 2y ago> the morality of memory allocation as it relates to market economics … that you could only produce if you are truly clueless I’m actually very curious to see that! I’m not sure what the angle espoused there is, but it seems fun at least from the perspective of academic science and technology studies to consider. This person might be going through a few too many scales to make meaningful commentary there though… In any case, there can be interesting connections and bidirectional influence found between technical systems and social organizations/politics/commercial industry, especially when it comes to things like how standards are defined over time. Even selecting the standardized sizes of containers for shipping and the technical design of connectors between shipping containers/cranes for picking them up has an interesting social and economic history that touches on questions of changing relationships to labor in post-war America! This guy might be spouting total nonsense, but it seems interesting and fun to read either way! Edit: I’m also not sure why trying to understand relationships between technical entities (like a programming language) and the systems it exists within, even if misguided, disqualifies the outputs of this person? Maybe there are plenty of other reasons, and maybe what they were saying was in fact batshit, but with zero context, I’m genuinely curious to learn more about what was said that was so crazy!
- JonChesterfield 2y agoI think I'm over "C but better" as a language design premise. C is really good as a low level language. The control you give up over assembly is well chosen. The syntax is fine. You have to tell the compiler to now screw you which is crazy as a default but doesn't matter much in practice. I've just spent a week doing ~ nothing other than writing C. It's been great. The language does exactly what you tell it to. Generating C to do things from tables of data is very easy. I especially like the zero context switching that comes from being able to remember the language. Python or C++ involve far too much looking up documentation. It's the wrong tool for solving most problems but the right tool for telling a computer what to do.
- bxparks 2y agoC may be the best example of "worse is better", but every time I do something non-trivial with it, I wish there was something better: * Undefined behavior, there are apparently over 100 of them. I can probably name about 5, maybe 10. Will the compiler warn me if I accidentally trigger undefined behavior? Of course not, it assumes that I am super-human who never makes a mistake. * Code sharing using '#include', god I hate 'em. * No namespaces, which means a single global namespace for all functions. * Strings: every time I have to manipulate strings in C, I want to shoot myself. * Arrays decaying into pointers, very clever, causing so much misery. * Array length decoupled from the array pointer. No way to pass around both of them together, and checked automatically by the compiler. * The C preprocessor #define magic. Love 'em when they are mine, hate 'em when they are someone else's. Hate 'em even more when they are mine 6 months later. * The #define/#ifdef spaghetti code. There ought to be better ways to support multiple architectures. Those are just off the top of my head. I'm sure I could come up with a few more items.
- JonChesterfield 2y agoThe UB is a lot more manageable if you pass nostrict-aliasing and similar to the compiler, or if you use a compiler that doesn't do that style of trickery. The includes and raw pointers are a build your own abstraction thing. Annoying if the abstraction you're building is the one a different language gives you to work with. For example, a struct with multiple arrays of the same length - in C that's multiple pointers and one size, in other languages that's probably multiple sizes and asserts that they haven't diverged. It's not a perfect language but it's really rather good.
- mrichman 2y agoWhy is manual memory management a virtue? I'd rather fight the Rust compiler than deal with runtime errors, memory leaks, etc.
- simon_void 2y agoGarbage Collections destroys any real-time guarantees you might need, since the GC can be triggered at any time. So for some classes of applications a GC is not an option (e.g. in 3D-video games you don't want your rendered frames per second to drop under 60 frames per second).
- pebal 2y agoYou can have a pause-free GC, where the collector runs in a separate thread and never pauses the mutator threads.
- packetlost 2y agoRust doesn't generally have a garbage collector though. This doesn't apply to the general case (ie. unless you go out of your way to add a GC into your runtime)
- masfoobar 2y agoYou might find this to be an interesting read:- https://loglog.games/blog/leaving-rust-gamedev/ https://loglog.games/blog/leaving-rust-gamedev/ In this, they make a good point about refactoring more with Rust than other languages. In some cases, "fighting the compiler" is not always want you want to do, especially when mocking some code/game state.
- WhereIsTheTruth 2y agoOdin is pretty nice, except for its RTTI, bloated executable as a result with the name of your types in clear, author of the language is against having compile time type introspection, so you are stuck with having to do reflection at runtime.. It could have been the perfect language for me, it's unfortunate