Some months ago, I got really fed up with C.
Like, I don’t hate C. Hating programming languages is silly. But it was way too much effort to do simple things like lists/hashmaps and other simple data structures and such.
I decided to try this language called Odin, which is one of these “Better C” languages. And I ended up liking it so much that I moved my game Artificial Rage from C to Odin. Since Odin has support for Raylib too (like everything really), it was very easy to move things around.
Here’s how it all went.. Well, what I remember the very least.
↫ Akseli Lahtinen
You programmers might’ve thought you escaped the wrath of Monday on OSNews, but after putting the IT administrators to work in my previous post, it’s now time for you to get to work. If you have a C codebase and want to move it to something else, in this case Odin, Lahtinen’s article will send you on your way. As someone who barely knows how to write HTML, it’s difficult for me to say anything meaningful about the technical details, but I feel like there’s a lot of useful, first-hand info here.
I have not used Odin, but the syntax looks pascal-like. I’m guessing the author never used pascal derivatives before.
Here here! C headers are one of C’s worst traits… More modern languages like java/C#/etc save so much time by eliminating the need to duplicate function prototypes across files. While an IDE might help a bit, it’s busywork that thankfully doesn’t have to be done in other languages.
I feel the same way. Some IDEs offer this as a feature, but sometimes it’s nice to use languages that just works without needing a crutch.
Hmm, I don’t like that. I seem to recall that units in pascal could call on each other, although I may be misremembering things. Anyone have a fresher memory of it?
That said, C’s dependency requirements suck as well. It just so happen that C has a single context and you can include as many files as you want into it, but the ordered dependencies make is extremely cumbersome. Even after using it for decades, I hate that it’s still a problem. Also if you want to use inline function optimizations you actually have to move the function’s implementation between header and source files, ugh. This split is one of the first things all new languages aim to fix.
I’ve gotten quite proficient at working with C strings as character arrays, but I’d agree that strings are important enough to have language abstractions for them. The lack of native & secure strings is undoubtedly responsible for countless memory errors in C software throughout the years.
Interesting, this isn’t something I’ve used before. I don’t actually mind explicit frees. It makes the code clearer, but it’s unforgivable that we’re still using languages & compilers that can’t automatically verify correctness. 🙁
I agree with most of these shortcoming of C. I’m glad the author found happiness with Odin. I’d highly recommend Dlang for all the same reasons, with a syntax that is closer to C.
https://dlang.org/
I don’t know, I can’t wrap my head around why odin was created. It just doesn’t seem to solve a real problem that isn’t solved by any one of the other c like languages, other than “different syntax”. Maybe I need to spend more time looking at it, but it doesn’t immediately seem to promise me anything useful for existing or new projects.
After looking at it a little more the answer in a large part might just be: It was created by someone in the game industry that understands what’s needed in games and has ensured that the necessary libraries are present. Neat, maybe it could cross over into not game development systems programing if it gets used there enough. Its important for a young language to have a niche to develop in and catch on. The most important factor in using a language is its popularity. You use what other people use and the trails have been blazed, ides written, other devs trained up on, security holes patched, golden paths identified, etc.
New programming languages are nice but to catch on they need a large-enough ecosystem. Rust is a well-liked language but its position in the game world is still very marginal and it doesn’t help that there are no credible stable game frameworks for it yet. Tiny Glade is an encouraging example of a Rust game but they use their home-made framework. Interesting to see how Odin manages in the same context.
Timo,
Indeed this is a challenge for most new languages. C/C++ benefit from strong deployment in both FOSS and commercial software stacks. The results is many devs choosing it without question due to it’s support. For better or worse, popularity matters a lot. A superior language doesn’t necessarily translate to more success.
Frameworks are definitely one area where new languages can struggle. They also need to minimize evolutionary baggage, which implies having a strong feature set and framework from the start. The easiest way to achieve this might be to copy a mature framework rather than building one from scratch.
C# managed this by copying much of java’s framework on day 1 as a starting point. The result was a good language and framework. It has a strong following in business software and is well supported. Although not appropriate in low level software, C# for business software makes sense.
Websites on the other hand have standardized on PHP as the defacto standard language. It’s readily apparent that it’s authors were very inexperienced and not qualified to build a language or framework when they started.. They were just young kids and didn’t know better, but the result is that a lot of mistakes were made. They learned from their mistakes and PHP would improve over time (with more breaking changes than I can count). But it remains messy because they didn’t have critical features like namespaces, OOP, or consistent naming conventions, etc from the start. This left PHP as a mess from the start. The language would eventually get the missing features, but much of the framework remains the byproduct of “lets throw spaghetti at the wall and see what sticks”.
The problem new languages face, at least for me, is that there’s just too much existing code that isn’t written in said language. Porting code is usually time consuming and counterproductive. If a language had a feature to automatically port code from other languages (and do so flawlessly), that could actually be a game changer in my book.
Are you porting from ‘C’ or from ‘C++’?