TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Odin, a Pragmatic C Alternative with a Go Flavour

114 点作者 hmac1282大约 19 小时前

18 条评论

johnnyjeans大约 13 小时前
For me, I don&#x27;t really look at Odin as a successor&#x2F;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&#x2F;fixer of Pascal. It doesn&#x27;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 useful built-in primitive data structures like associative arrays and matrices, custom allocators, function overloading, reflection, etc.<p>You can find odds and ends of these things in other Pascal successors like Delphi, Oberon and Object Pascal. Truth is though, I never found these languages compelling. Why? Because none of them were anywhere close to being the same kind of simplicity as Pascal, and they were too wrapped up in flashy, trendy things that went out of style. Where Odin wins out is that it distinctly lacks the 90&#x27;s OO craze hangover, and it never feels particularly more complicated or bloated. It&#x27;s an audaciously tasteful proposition for a language. A C replacement? No, not really. But as a C++ programmer who&#x27;s fed up with the lack of things like structure introspection and ergonomic sum types, I&#x27;m keeping a <i>very</i> close eye on Odin.<p>[1] - <a href="https:&#x2F;&#x2F;c3-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;c3-lang.org&#x2F;</a><p>[2] - <a href="https:&#x2F;&#x2F;harelang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;harelang.org&#x2F;</a>
评论 #43944109 未加载
评论 #43942209 未加载
评论 #43943781 未加载
评论 #43943488 未加载
评论 #43943410 未加载
taylorallred大约 16 小时前
Odin really hits the sweet spot for everything you would want from a language for the game dev and game-dev-adjacent space in terms of simplicity, convenience, and speed. I think a major design decision of the language that will make or break it for users is the fact that the language gives you common features instead of giving you the means of abstraction to make those features yourself. For example, instead of preprocessor macros you get the `when` clause for conditional compilation because in Bill&#x27;s estimation, that&#x27;s one of the only real needs for macros. The same goes for data structures. Odin gives you the certified classics like dynamic arrays and maps but doesn&#x27;t give you a whole lot to make your own custom data structures (it&#x27;s possible, just not encouraged by the language design). All in all, I think if you want to make an application with a language that has batteries included and you don&#x27;t need a lot more than that, Odin is nearly flawless.
评论 #43941531 未加载
rednafi大约 6 小时前
Odin truly feels like a C successor, and as someone who likes Go, it appeals to me a lot more than Zig or Rust. Partly because it took inspiration from the Pascal, Delphi, Oberon branch, same as Go.<p>I don’t particularly enjoy working on the types of problems Zig or Rust aim to solve. I spend the majority of my time working at layer 4, and Go makes it immensely enjoyable. But sometimes I want a bit more control over the hardware and don’t want to pay the cost of a GC. Odin feels just right.<p>In my case, the assortment of syntactic features like OOP, compile-time macros, or even the borrow checker suck all the fun out of programming. That’s why I still enjoy writing C programs, footguns and all.
ossobuco大约 4 小时前
I&#x27;ve been using Odin for the last ~6 months, wrote a 15k loc project and it&#x27;s been an absolute pleasure. This is my first low level language after 10 years of web dev, and it feels much higher level than it is, while giving you the control and performance of a language like C.<p>I like pretty much every choice that has been taken when designing the language, except maybe the lack of namespaces, which can be solved anyway with prefixes.<p>The lack of OOP features is the best part for me, it&#x27;s rewiring my brain in a good way and I can now also reason much better about RDBMS schemas. Data oriented design is the most helpful approach I&#x27;ve stumbled upon in my career.
thegeekpirate大约 10 小时前
When I first saw Odin, I wrote down a list of everything I didn&#x27;t think I&#x27;d like.<p>After several thousand lines, it proved all of my major worries incorrect, and has been an absolute pleasure.<p>It has since replaced my usage of Go, which I had been using since release.<p>I would highly recommend giving it a proper shot!
评论 #43944054 未加载
vandyswa大约 15 小时前
FWIW, another take on &quot;C Alternative&quot; is the D programming language:<p><a href="https:&#x2F;&#x2F;wiki.dlang.org&#x2F;Tutorials" rel="nofollow">https:&#x2F;&#x2F;wiki.dlang.org&#x2F;Tutorials</a><p>Comparatively mature, there&#x27;s even a freeware book which is quite good:<p><a href="http:&#x2F;&#x2F;www.ddili.org&#x2F;ders&#x2F;d.en&#x2F;index.html" rel="nofollow">http:&#x2F;&#x2F;www.ddili.org&#x2F;ders&#x2F;d.en&#x2F;index.html</a>
评论 #43941663 未加载
评论 #43941439 未加载
评论 #43941915 未加载
pbohun大约 17 小时前
I&#x27;ve started experimenting with Odin for some personal projects and it&#x27;s been great. The built-in vendored libraries make creating certain programs trivial. For example, just `import rl &quot;vendor:raylib&quot;` and you can use `rl.InitWindow(800,600,&quot;Test&quot;)`. No need to install Raylib, add to path or use special linker directives, just `odin build .`!<p>Also I think Odin struck the right balance of features while trying to keep to the spirit of C.
ultrarunner大约 15 小时前
As a completely incidental observation (and maybe related to the article from a few days ago considering the importance of language skills compared to math skills for software development), I&#x27;m interested in what people choose to capitalize when developing languages. With c, lowercase seems to be the default, signifying variables or function calls. Adding inheritance in c++ leads to Proper Nouns like classes being capitalized, while their instances are often lowercase. This communicates a subtle &quot;feel&quot; for the language, meta information about what&#x27;s being accomplished.<p>Capitalizing method calls (`rl.InitWindow()`) seems to place the importance on the Method being called, but at first glance (ASP, or Go off the top of my head) it muddies the waters. If this isn&#x27;t clear, consider that capitalizing ALL code would reduce clarity as all letter shapes are now essentially the same (a box).<p>I spend most of my time in c, c++, ruby, and javascript, but maybe I should try to do a personal project in Go (or Odin) for this reason alone.
评论 #43941346 未加载
评论 #43944217 未加载
评论 #43941180 未加载
评论 #43942804 未加载
leelou2大约 14 小时前
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-world experiences!
评论 #43941550 未加载
throwaway81523大约 7 小时前
I don&#x27;t understand the point of this. When I say &quot;Go flavour&quot; I thought it would have lightweight threads like Go, but there is no mention of that in the description page. So it&#x27;s another uninteresting curly brace language as far as I can tell. I&#x27;d rather use one with more traction.
评论 #43944098 未加载
mcbrit大约 15 小时前
I am currently limiting myself to 500 lines of (particle engine) code while listening to visual artists talking about their workflow in UE5 or Houdini, and Odin+Raylib are lovely to work in.<p>GingerBill has shouted out Go, but Odin doesn&#x27;t particularly feel like a Go flavo(u)r.
评论 #43940948 未加载
yawaramin大约 7 小时前
Can someone explain how Odin achieves memory safety? Eg how does it avoid use-after-free?
评论 #43944250 未加载
评论 #43944027 未加载
评论 #43944102 未加载
评论 #43943646 未加载
gitroom大约 14 小时前
been playing around with odin and honestly the ease of getting started feels way better for me than most c-like stuff ever has. you ever think these smaller pain points keep more folks from switching than big technical features?
throwawaymaths大约 16 小时前
&gt; This is the polar opposite of Zig’s embracing of metaprogramming for as much as possible.<p>I found this claim a bit strange. do people actually use metaprogramming in Zig a lot?
评论 #43940840 未加载
评论 #43940644 未加载
评论 #43941935 未加载
评论 #43941255 未加载
Dwedit大约 9 小时前
How does this compare with Zig or Beef?
WhereIsTheTruth大约 17 小时前
I like odin a lot, however, there are two things that just don&#x27;t stick with me, and i ended up quitting:<p>- RTTI: just give me compile time type introspection and let me disable RTTI without making the language unusable<p>- when&#x2F;import: just let me wrap an import inside a when block, being forced to split my file in 3 made me quit the language
评论 #43942085 未加载
评论 #43944058 未加载
mistrial9大约 8 小时前
re Odin -- I do not like reusing important names in this way. Can I be the only one?
评论 #43944311 未加载
James_K大约 16 小时前
A C alternative means a language that will last for 50 years, whereas this seems more like &quot;whatever&#x27;s popular by way of LLVM&quot;. I can see some real smart stuff coming out of languages like Zig and Rust, where Odin seems just to follow along.
评论 #43941785 未加载
评论 #43944354 未加载