9 ms·
The Odin Programming Language
- rendaw 3y agoLooking at their front page, they have the following distinguishing goals: Simplicity, speed, modern, pleasant. Is there _any_ language that doesn't aim for those four things? I have no idea why I'd choose Odin.
- gingerBill 3y agoMany languages don't aim for that. As it states on the front page: > Odin is a general-purpose programming language with distinct typing built for high performance, modern systems and data-oriented programming. > Odin is the C alternative for the Joy of Programming. So if you have a problem that would have traditionally use C (or even C++), then Odin provides a more modern approach built for modern systems and higher control over low-level things such as memory, memory layout, memory access, and custom allocators.
- vsuperpower2020 3y agoI'm waiting for the language and toolset to mature before I give it a serious chance. Not having an increment operator also is kind of disappointing. Why not name Odin C+=1?
- masfoobar 3y agoI am really enjoying Odin. My time on it is limited at the moment. I am working 2 jobs which is eating my weekly hours. When I have more time (leaving one job in April.. yay!) I plan to contribute to Odin more. Currently, I would guess many view Odin as a niche language in the gaming circle. A bit like Jai. I want to try and change that mindset or reputation.. to build apps in Odin that are not games (though I plan to move a game I wrote in C to Odin as a fun experiement) I am currently binding a C library to Odin which my early tests are working pretty well. Plan to announce more, hopefully, in the coming months. I have also experiemented with existing libraries like odin-http and odin-mysql (by a chap named layton who helps alot on odin discord) -- I need to build a family website/blog and tempted to use Odin with htmx. The only area of critique to Odin, especially those that are accustomed to them... is a package manager. Now I am in favour of package managers. C# Nuget is good. However, for Odin, I have been happy to create a third-party folder and 'git clone' the repos I need:- import http "../third-party/odin-http" // rough example.
- nateb2022 3y agoRecent related discussions: Small joys of programming in Odin - https://news.ycombinator.com/item?id=36812175 https://news.ycombinator.com/item?id=36812175 (61 comments) A Review of the Odin Programming Language - https://news.ycombinator.com/item?id=32799499 https://news.ycombinator.com/item?id=32799499 (142 comments)
- rwbt 3y agoHuge fan of Odin, true C successor. Much better ergonomics and fun to program than say Zig. But needs the following in my view - - A way to generate bindings automatically from C Headers or even better - not having to generate bindings separately and just import C headers directly. - Better tooling and standard library improvements. I think Odin & Nim are my two favorite "modern" languages but they fill different niches. I see Odin as mainly replacing C while Nim is more a C++ replacement (but with Python like rapid development). I'm always amazed at how productive Nim is but the language has many areas that I'm not familiar with (the AST Macros for example). But Odin mostly fits in my head.
- gingerBill 3y ago> A way to generate bindings automatically from C Headers or even better - not having to generate bindings separately and just import C headers directly. We do want to have an official bindings generator as part of the toolchain. There have been numerous third-party ones that people have created, but we need to have an official one now. However, automatically importing C headers is not actually what virtually anyone wants in practice. Once you have imported the C header file, you pretty much want to: * wrap the entire thing * change the types to better reflect what things are (using Odin's richer type system) * change names of things to better reflect usage and intent * reorganize the declarations to better read things * etc There is also the second issue that C is technically TWO languages: the C programming language and the C preprocessor. People mix the two together and things cannot be easily translated. A good basic example of this is people using `#define` for constants, and thus that name has no semantic meaning in the language itself. A translator has to try and make some semantic meaning from the intersection of these two languages, even if people don't make a distinction when making APIs. And Odin's `foreign` system allows [1] for a lot of really nice things that most other languages cannot do so tersely. Here are two examples of demonstrating bindings of C libraries that feel as if they were native Odin libraries WITHOUT any wrappers: * https://github.com/floooh/sokol-odin/blob/main/sokol/gfx/gfx.odin https://github.com/floooh/sokol-odin/blob/main/sokol/gfx/gfx... (and the rest) * https://pkg.odin-lang.org/vendor/sdl2/ https://pkg.odin-lang.org/vendor/sdl2/ and https://github.com/odin-lang/Odin/tree/master/vendor/sdl2 https://github.com/odin-lang/Odin/tree/master/vendor/sdl2 > Better tooling and standard library improvements. Any concrete examples/ideas that you can give? --- [1] https://odin-lang.org/docs/overview/#foreign-system https://odin-lang.org/docs/overview/#foreign-system
- Decabytes 3y agoThe fast Fsharp guy recently switched to Odin for performance and calls the Odin code in Fsharp. I like Fsharp so I’m curious about this combo https://x.com/fastfsharp/status/1735311963260141645?s=46&t=hrljSsmrQ0indCSy8h-Wuw https://x.com/fastfsharp/status/1735311963260141645?s=46&t=h...
- neonsunset 3y agoThat account is not led by a person with performance knowledge despite what the name suggests. Previously, its author failed to profile the code and use existing package which does the vectorized sum suggested by multiple people and was comparing the code where the compiler couldn't prove it doesn't go out of bounds versus pointer arithmetics. The comments to other posts of that account pointed that out yet the feedback was completely ignored. It's a skill issue to try to want to use FFI for this over implementing a function in C# out of personal spite.
- akkad33 3y agoHe works on high speed simulations. What is the personal spite you refer to?
- vsskanth 3y agoIs there a list/comparison of C-Alternative systems programming languages available ?
- lerno 3y agoIf you aren’t looking for languages that have more fancy memory management things (ref counting, borrowing or similar) then the active ones I know of are in alphabetical order: C3, Hare, Jai (might be slightly more of a C++ alternative), Odin and Zig. Additionally: Hare stated Win and Mac will be unsupported. Jai is still closed source.
- frfl 3y agoI don't know about a list online but here's what I know off, in the C/C++ realm Odin - https://odin-lang.org/ https://odin-lang.org/ Zig - https://ziglang.org/ https://ziglang.org/ Beef - https://www.beeflang.org/ https://www.beeflang.org/ Jai (not public yet) - [1] Carbon (C++) - https://github.com/carbon-language/carbon-lang https://github.com/carbon-language/carbon-lang D Lang - https://dlang.org/ https://dlang.org/ Rust - https://www.rust-lang.org/ https://www.rust-lang.org/ cppfront (Herb Sutter's C++ frontend/syntax) - https://github.com/hsutter/cppfront https://github.com/hsutter/cppfront Nim - https://nim-lang.org/ https://nim-lang.org/ Crystal (not sure if this counts) - https://crystal-lang.org/ https://crystal-lang.org/ Vale - https://vale.dev/ https://vale.dev/ Hylo (formerly Val, just found it now) - https://www.hylo-lang.org/ https://www.hylo-lang.org/ Vala (compiles to C, some GTK apps are written in this) - https://vala.dev/ https://vala.dev/ C3 - https://github.com/c3lang/c3c https://github.com/c3lang/c3c Rune (last commit 7 months ago) - https://github.com/google/rune https://github.com/google/rune Kit (dead, last commit 5 years ago) - https://github.com/kitlang/kit https://github.com/kitlang/kit There's probably more. That's all I can recall off the top of my head and/or what I have in my notes. There's also Haskell [2], which compiles down to C-- [3] (a C like language). Not sure if this counts either. [1]: https://en.wikipedia.org/wiki/Jonathan_Blow#2017%E2%80%93present:_Jai_programming_language,_untitled_Sokoban_game,_and_Braid,_Anniversary_Edition https://en.wikipedia.org/wiki/Jonathan_Blow#2017%E2%80%93pre... [2]: https://www.haskell.org/ https://www.haskell.org/ [3]: https://en.wikipedia.org/wiki/C-- https://en.wikipedia.org/wiki/C--
- alphazard 3y agoI think Odin is the best language in this niche so far. And although I prefer it slightly to Zig, I expect Zig to eat Odin's lunch. Odin seems to have procrastinated the important things that cause a language to really take off, in favor more trivial features. At this point I think Odin has crossed into the territory of being wrong in the direction of too many features rather than too few. While having not delivered important tools that would cause the language to accrete an ecosystem. A must-have for wide adoption is a package/dependency manager. As I've said before: Just clone what Go has. Just take it, you need it to be popular, and you probably aren't going to do better. `import "github.com/whatever"`. I believe Zig has already started on a package manager, while the sentiment in the Odin community is that the unnecessary concept of "collections" somehow solves the dependency problem.
- gingerBill 3y agoI am the creator of the Odin programming language, and thank you for the rhetorical insult :) > procrastinated the important things that cause a language to really take off, in favor more trivial features. So I should have focused on making a hype language rather than actually solve problems in programming that can be solved a the language level? I don't think anyone would call that "procrastination". > At this point I think Odin has crossed into the territory of being wrong in the direction of too many features rather than too few. While having not delivered important tools that would cause the language to accrete an ecosystem. That's vague as anything. Can you give any concrete examples? > A must-have for wide adoption is a package/dependency manager. And because Odin has a well defined concept of what a package is in the language itself, then creating one would be trivial for someone to do. Now this is going to be a VERY VERY controversial take but I do not want to __officially__ support a package manager. I know it's "so nice" to do something like `go get`, but I am not a huge fan of package managers in general and I honestly and truly believe that they have caused a huge amount of problems that cannot be solved by their existence. Please do not speculate what I "prefer", but I will not explain in this comment since it would take an entire article's/video's worth of explaining. > while the sentiment in the Odin community is that the unnecessary concept of "collections" somehow solves the dependency problem. This is just incorrect. There are few people who are working on a package manager for Odin, there is just not an OFFICIAL package manager. And that is not what a library collection is for either. A library collection is a named search lookup. All imports are relative to either the current file OR a named library collection (a named directory). This solves the problem in C with `#include <...>` where you don't know how it is searching, whilst in Odin `import "core:fmt"` or `import gl "vendor:OpenGL"` or "import "../foo" has been made EXPLICIT where it is searching from. ---- I am not trying to create a "hype language" but actually make a language that solves mine and loads of people's actual problems. I do not view that as any form of procrastination whatsoever, and that you do is quite sad.
- keyle 3y agoI had a play with Odin late last year and it was a blast. It needs to get to a more finalized state, design wise, and a good package manager for adoption and I suspect it will do really well. I'm toroughly excited for this language's future. As all LLVM languages, debugging is really easy. Please help Odin succeed in whichever way you can!
- gingerBill 3y agoWhat about Odin the language is needs to be in "a more finalized state, design wise"? As for a package manager, see my reply on another comment: https://news.ycombinator.com/item?id=38840407 https://news.ycombinator.com/item?id=38840407
- deleted 3y ago[deleted]
- HL33tibCe7 3y agoInteresting: this looks heavily inspired by Go, but it supports things like sum types (the lack of support of which is one of my biggest gripes with Go).
- stevage 3y agoThey could really improve their sample code/demos. Particularly the default one - for a "data-oriented" language, having the first demo be parsing and executing a nonsensical calculator language is a weird choice.
- gingerBill 3y agoI highly recommend looking at: * The Overview: <https://odin-lang.org/docs/overview/ https://odin-lang.org/docs/overview/> * examples/demo: <https://github.com/odin-lang/Odin/blob/master/examples/demo/demo.odin https://github.com/odin-lang/Odin/blob/master/examples/demo/...> As for the first example: a basic lexing example is probably boring, but it does show some basic ideas of what the language is about. If people want to write better examples or just reorder the current ones, please feel free to make an issue or PR on the website's GitHub page: <https://github.com/odin-lang/odin-lang.org https://github.com/odin-lang/odin-lang.org>.
- nerdponx 3y agoThis seems to be a problem in other languages as well. Note to people making languages: implementing an interpreter is not a useful demo for most people, even if you, a language designer, think it is.
- mappu 3y agoThe "built-in support for SOA data types" on the homepage is a really cool data-oriented feature. This is what i imagine Go would look like with that: https://github.com/golang/go/issues/64926 https://github.com/golang/go/issues/64926
- itishappy 3y ago> JangaFX are the creators of the 3D animation software EmberGen written fully in Odin. Whoah. That's quite the demo reel.
- Decabytes 3y agoI’ve been leaning more towards a dual language approach recently. A language with tight integration with C like Lua, or Gambit, that makes it easy to drop down to C. C gets treated like a block of unsafe Rust code, and you keep as little of the code base in C as is necessary
- dualogy 3y agoWhat I never get about the huge Lua popularity in C/C++ land is how people manage the mental switch between 0-based and 1-based indexing. Or is this tunable from the VM/JIT-hosting side? Because if I were to use Lua-the-language standalone, I'd lose all my "mental automatics" for real basic arraying/looping stuff that serve in day to day in the non-Lua workloads of C/++, Go, the occasional TypeScript etc.
- defrost 3y agoIt might be because I'm old and grew up with carpentry and fence and post around a paddock real life problems but there's no switch if you seperate the two as two distinct things. If you make a pigeon hole row of boxes, box number 1 has an index of 1 and an offset of 0 (from the origin mark). C arrays are syntactic sugar for origin based offsets, Fortran arrays are indexed by element number. In C arr[i] is equivalent to i[arr] is equivalent to arr + i and to i + arr.
- rwbt 3y agoThis is what I've been thinking lately i.e. C and Lua (throw in LuaJIT too if speed is needed). But I've found out that using functional parts of modern C++ (bear with me) as a higher level language with C underpinnings also works very well. But you need tremendous discipline to do it successfully. For eg - using only C POD structs, no constructors, no exceptions, no inheritance, limited template usage etc. Some would say a very C style C++ with a lot of syntax sugar.
- dualogy 3y agoThat's how any C++ stuff of mine goes, "given the chance", ie. the self-contained, private/hobbyist stuff. With structs instead of classes you still have the convenience of instance methods (rather than just mynamespace_funcname funcs), statics, even namespaces (hardly necessary with methods and statics), yet can avoid inheritance and the whole public/protected/private noise (public by default, otherwise structs and classes are exactly equivalent in C++) except for the rare case where it does seem beneficial over a simple field.
- mroche 3y agoI can barely keep track of the number of languages that exist today. I feel like the answer is Wikipedia, but it would be great to have a central resource that language authors and communities could contribute to. Just answering the questions: - What is the origin of the language? - What use cases are the language best suited for? - Language highlights? - Language examples? - Maybe language comparisons?
- flysand7 3y agoI'll reply to this comment, just in case anyone else is curious. The origin of the language: gingerBill got drunk one night and wrote a compiler. Seriously though, it was an attempt to create a language that would be a reasonable C alternative - simple semantics, usable for performance-critical applications (mainly games and engines), good support for tooling. I would also describe it close to something with underlying mechanics of C combined with the niceness of Go. Odin does improve on Go in a lot of places. The use cases would be similar to C or C++. There's not much different in the way of memory management / the way objects are stored in memory etc. There is a concept of an allocator which could make Odin a better candidate for good performance when you allocate memory (i.e. putting everything on heap can be slower than bump allocators) Some of the coolest features I've found using the language - bitsets (make a set of flags out of an enum), slices, which C didn't have but are so nice to use, the or_return, or_continue and or_break operator (hello, Go programmers, tired of writing if err != nil yet?). Language comparisons: unlike C: Has simpler syntax, easy to parse, has slices, bitsets, sized enums, templates. unlike C++: doesn't have operator overloading, has simpler semantics, the standard library is readable. unlike Rust: no borrow checker, limited lifetime checking (can detect using stack values that have dieded), no lifetime annotations, limited support for typeclasses, no pattern matching, no traits. I wouldn't compare it to Rust, honestly, it's a different kind of language. unlike Go: I haven't used Go in a while so forgot a few details, don't quote me on these: it doesn't have var syntax for declaring values, you can not shadow tuple declarations at all, support for or_return syntax, tuple returns can be used to saturate arguments of another function, doesn't have garbage collection. Doesn't have a package manager.
- gingerBill 3y ago
- tombert 3y agoI always feel like a bit of an outsider with these things; I see stuff like Zig and Odin and Nim being posted, and everyone on HN talking about how great they are, and I feel like I'm missing something. I have absolutely no desire to going back to manual loops instead of `map` and `reduce` and `filter`, and I have no desire to go back to imperative style, but I appear to be somewhat in the minority on this. Everyone seems to love Go now, and people keep telling me that they like the language because it's "simple", but I have absolutely no god damn idea how they explain that. I know C well enough to do an interview or hack on FreeRTOS, and I've done a fair amount of paid Go work in the last few years, and despite that I am always craving for a functional language. Any functional language. Give me Haskell or Lisp or OCaml or F# or Rust or even JavaScript.
- mjburgess 3y agoIt's the aesthetic of programming as "solving the actual problem", vs. programming as "solving the problem of how to solve the problem". When you're solving the actual problem imperative is largely the right default: each line clearly relates to the actual problem; and it's clear how the actual problem is being solved. When you're bored, or have no actual problems, it's fun that every line is a little puzzle.
- tombert 3y agoI think I disagree with this entirely. With imperative you’re actively translating the problem in terms of how things are going to be interpreted by the CPU. With functional you actual express how to solve the problem and trust that the language constructs will handle stuff like loops for you.
- flohofwoe 3y ago> ...manual loops instead of `map` and `reduce` and `filter`... ...you're free to implement such functions in a Zig/Odin/Nim library as well, but in the end it's just another way to loop over data, and inside your own implementation there will be regular loops, so why bake this stuff into the language when it can be done just as effciently in a library.