9 ms·
The Odin Programming Language
- kwertyoowiyop 5y agoWhy can’t the command to print just be “print”? :-(
- emschlr 5y agoExactly! I don't understand why modern languages can't make "print" simpler. Is it too much to ask to expose a print function in the default namespace?
- deleted 5y ago[deleted]
- gingerBill 5y agoIt is too much to ask for because Odin is not trying to optimize for beginners nor is it trying to pollute the global namespace with things that require a large runtime. Odin is a systems level programming language and you may not want to use such a feature that uses RTTI in the first place. Is doing `import "core:fmt"` or something else too much to ask for?
- kwertyoowiyop 5y agoI just want a language to meet me half way. Very little is “too much to ask for,” but why not eliminate boilerplate? If it’s a special case, I will sacrifice a goat to the gods of engineering purity and hope they forgive me.
- skytrias 5y agoif you really care about that so much you can create an alias procedure with a different name and use that throughout your package import "core:fmt" print :: fmt.println // you can use print("test") now
- deleted 5y ago[deleted]
- amw-zero 5y agoWhy can’t comments about new programming languages be more interesting than this?
- kwertyoowiyop 5y agoIn this case, it’s because I wrote it. Between you and me, I’m not that smart.
- jotoro 5y ago
- labrador 5y agoFrom the Ginger Bill website "It is designed with the intent of replacing C"
- gingerBill 5y ago> Odin is the C alternative for the Joy of Programming. It is not intent on replacing C since that is not a feasible goal for any language. But making an alternative to C in the high performance modern systems is very much a feasible goal and Odin is such a language.
- digitalsin 5y agoThe demo.odin source file literally says: "It is designed with the intent of replacing C with the following goals:.." Anyway, this looks really cool!
- gingerBill 5y agoThis has now been corrected.
- ksec 5y agoPrevious Discussion: The Odin Programming Language (143 comments ) https://news.ycombinator.com/item?id=22199942 https://news.ycombinator.com/item?id=22199942 Looking into Odin and Zig ( 27 comments ) https://news.ycombinator.com/item?id=28440579 https://news.ycombinator.com/item?id=28440579
- livinglist 5y agoI barely wrote go before but this looks like go at the first glance.
- ruune 5y agoThe example is go except for the colons. But maybe it's just the syntax and the rest is different
- gingerBill 5y agoGo is an Garbage Collected language with object oriented features and CSP like concurrency semantics. Odin has none of these built into the language and never will. Go was designed to be a language for web server backends, not general systems level programming such as game development, graphics programming, kernel development, etc. Odin has numerous features tailored for high performance, modern systems, along with numerous data-oriented things such as SOA data types, array programming, high control over memory layout and memory allocation, custom memory allocators, and much more!
- alophawen 5y agoI'm pretty sure parent is referring to the syntax.
- atdrummond 5y agoWhy should I use this over, say, D?
- jessermeyer 5y agoThis depends on your reasons for using D. Odin is a smaller language for one (no compile time execution, for example).
- pie_flavor 5y agoOdin seems like a bunch of features copied from a bunch of different languages without making sure they're (a) good and (b) consistent. Things like ranges being `1..5` in one context but `1:5` in another, or having range-based iteration but still having classic for loops which ranges almost completely obsolete, or functions that may or may not allocate without having automatic deallocation. `or_return` is a significant improvement on Go's error system, but why not add an actual error system while you're adding other higher-level-than-C function properties like `context`? `cast(type)value` is a significant improvement on C's `type(value)`, but why add the latter syntax to the language anyway, then tell people not to use it? Allocator-aware new/free functions are great, so why use the different functions make/delete for some language-defined data structures? Etc. There's a lot to like here, but it's a patchwork with bad seams.
- gingerBill 5y agoEvery "feature" in Odin was added because it has been shown to be good and consistent with the rest of the language. Slice expressions and range expressions being different was on purpose, as they are very different operations semantically and I wanted to make this clear with the syntax. You can try to unify them but then you lose the abilities to other things which make them distinct which the current syntax offers. It's allow about trade-offs. Odin does allow you have custom iterators, and C-like for loops do have their uses at times. `new` returns pointer. `free` takes a pointer. `make` returns a non-pointer data structure which contains internal pointers. `delete` will `free` the internal pointers for specific data structures. As for the other criticisms, I recommend trying the language itself first to see why they are made. It is not always possible to just do a quick read of a language to understand its decisions.
- fasfsadfsa 5y agoI don't feel you answered the questions fully. Telling someone to learn the language to get the rest of the answers isn't right and would put me off it because it suggests there aren't satisfactory reasons for the design. I'm sure that's not the case but still.
- masa331 5y ago"Programming Done Right"... closing the page
- zubspace 5y agoI'm intruiged by the vendor libraries [1] and EmberGen is definitely a nice showcase they have [2]. It's a nicer C with similarities to Zig. I'll definitely take a look. But I'm hesitant to fully dive in. I'm a bit overwhelmed by all the new "niche" languages coming out lately. Usually they have very valid use cases but mostly fall flat regarding tooling (debugging..), available libraries and documentation. It takes so much time to really grok a new language and then the next new shiny thing comes out... [1] https://github.com/odin-lang/Odin/tree/master/vendor https://github.com/odin-lang/Odin/tree/master/vendor [2] https://jangafx.com/software/embergen/ https://jangafx.com/software/embergen/
- samuell 5y agoIs this in any way related to the (no longer developed) Oden language [1] by Oskar Wickström? [1] https://oden-lang.github.io/ https://oden-lang.github.io/
- gingerBill 5y agoAbsolutely no relation whatsoever.
- samuell 5y agoOK, thanks for the info!
- lhorie 5y agoOh nice, there are API docs now. I had seen the language before but was put off by lack of stdlib docs at the time (a complaint I also brought up about zig some years ago) Definitely interested in taking it for a spin now.
- leecommamichael 5y agoI’ve enjoyed building GUI apps with Odin’s vendor libraries. I do wish debugging were more mature. I love the IDE-style debugging.
- scns 5y agoSome time ago someone asked here on HN, why no language has a Matrix type. Odin does: https://odin-lang.org/docs/overview/#matrix-type https://odin-lang.org/docs/overview/#matrix-type
- eyelidlessness 5y agoNot a criticism, but a general observation: it’s increasingly surprising to me, when looking into an unfamiliar low-level/systems language, to find that the language has WASM support but doesn’t shout it from their website. I’m sure that isn’t the most important thing to be preoccupied by, but it feels like a common enough ask at this point that I’d expect languages with a WASM story to make that fact easily discoverable. All that aside, at first blush Odin feels quite approachable from mostly high level experience. I am (and probably at this point will forever be) intimidated by manual memory management, but otherwise I read the overview on my phone and… nothing feels hard to grasp, everything easily maps to concepts I already recognize, and the prose explanations are written well for an audience of me. And I want to emphasize: I read this on my phone and found it valuable, that’s an unexpectedly good walk up experience.