The original Twitter thread: https://x.com/TheGingerBill/status/1508833104567414785 --- I have a huge gripe when I read articles/tutorials on OpenGL: most people have no idea what they are talking about when it comes to coordinate systems and matrices. Specifically: OpenGL is NOT right-handed; the confusion over column-major “matrices”. Let’s clear up the first point. Many people will say OpenGL uses a right-handed coordinate system. Loads of articles/tutorials will keep repeating the v...| Articles on gingerBill
[Originally from a Twitter Thread] Original Twitter Post “Killer Feature” Odin is a weird programming language to advertise/market for. Odin is very pragmatic in terms of its design and overall philosophy. Unlike all popular languages out there, it has no “killer feature”. I’ve tried to design it to solve actual problems with actual solutions. Those languages with a “killer feature” to them do make them “standout” and consequentially more “hypeable”. The problem is that ...| Articles on gingerBill
[Originally from a Twitter Thread] Original Twitter Post One thing many languages & API designers get wrong is the concept of a string. I try to make a firm distinction between: string value (string or char const *) string builder (strings.Builder or realloc+snprintf) Backing buffer for a string ([]byte or char *) They are not equivalent even if you can theoretically use them as such, and so many garbage collected language use them as such. They have different use cases which don’t actually...| Articles on gingerBill
[Originally from a Twitter Thread] Original Twitter Post Many people may not know this but this video by Sean Barrett @nothings is partially the reason why I made the Odin programming language. And I’ll explain what insights it gave me in this thread 🧵. A lot of these seem “so obvious” but for some reason it never clicked to me before this video. A lot of the “higher level” “scripting” languages are not that much higher level than C. Those languages just have garbage collecti...| Articles on gingerBill
For my work at JangaFX, we require the use of the Alembic interchange file format. We have been using other libraries which wrap reading the Alembic file format but because it is not the native library, it has numerous issues due to the generic interface. I spent nearly 4 days trying to get the official Alembic C++ API, https://github.com/alembic/alembic/, to compile correctly and then use the API itself. Numerous times the compilation would get corrupted (it compiled but none of the tests ev...| Articles on gingerBill
I have recently been thinking about multiple return values as a concept, and wondering if there has been any kind of literature into the topic of “true” multiple return values which are not emulated through tuples. My current working hypothesis is that I think I have come to the conclusion (unless there is evidence to the contrary) Odin has invented a new kind of type system, something to the akin of polyadic expressions. It appears that Go and Odin are the only ones with what I call “t...| Articles on gingerBill
Buddy Memory Allocation In the previous article, we discussed the free list allocator and how it is commonly implemented with a linked list or a red-black tree. In this article, the Buddy Algorithm and how it applies to memory allocation strategies. In the previous article, the red black tree approach was briefly discussed as a way to improve the time complexity for searching for a free memory block, and get best-fit as a consequence. One of the big problems with free lists is that they are v...| Articles on gingerBill
Free List Based Allocation In the previous article, we looked at the pool allocator, which splits the supplied backing buffer into chunks of equal size and keeps track of which of the chunks are free. Pool allocators are fast allocators that allow for out of order free in constant time O(1) whilst keeping very little fragmentation. The main restriction of a pool allocator is that every memory allocation must be of the same size. A free list is a general purpose allocator which, compared to th...| Articles on gingerBill
[Originally from a Twitter Thread] I have revisited The Value Propagation Experiment and have come to a different conclusion as to why it failed and how I recovered it. The recovery work has been merged into master now with this PR: https://github.com/odin-lang/Odin/pull/1082 I think there were three things which were confusing which make it look like a failure of an experiment: try was a confusing name for what the semantics were. try as a prefix was the wrong place. Unifying try with try el...| Articles on gingerBill
[Originally from a Twitter Thread] Part 2 of this Experiment The Idea I recently experimented with adding a feature into Odin which allowed for a way to propagate a value by early returning if that value was false or not nil. It was in a similar vein to Rust’s try! which became ?, or Zig’s try, etc. I have now removed it from Odin. But why? The Problem The hypothesis was that that this idiom was common: x, err := foo(); if err != nil { return err; } where err may be an enum, a (discrimina...| Articles on gingerBill
When I was designing the constant value system in Odin, I wanted literals (especially numbers) to “just work”. I was inspired by how both Ada1 and Go2 both handled their constant value systems. But this lead me to a realization that there are two general different models of thought when it comes to values in programming languages. Model-1: Expressions have a type, not all expressions may have a value. Therefore all values must have a type. Model-2: Expressions may have a value, not all ex...| Articles on gingerBill
Note: This is a “brain dump” article, and subject to be cleaned up. Categories of Structured Control Flow Procedure call foo(123, true) Terminating return Conditional if, if-else, switch Looping for - loop with initial statement, condition, post statement, and body for-in - loop with a value to be iterated over while - loop with condition then body do-while - loop with body then condition Branching break - go to end outside of the control statement continue - skip to the end of a loop fal...| Articles on gingerBill
I have been toying with a theoretical idea for the past 18 months off-and-on in my head and I have not fully articulated it aloud yet. It is regarding the concept of Ownership Semantics (OS) or Move Semantics in programming languages. Fundamentally this article is a criticism of the concept and states that the concept is a duality of traditional OOP but applied to a different area. General Definitions of Terminology A general list of definitions of terminology used within this article in orde...| Articles on gingerBill
Audio Article:| Articles on gingerBill
Absolute Pointers Pointers are a value type in programming languages that store a memory address. A pointer references a location in memory, and obtaining the value stored at this location in memory is known as dereferencing a pointer. Pointers are part and parcel of using languages like C, and are an extremely powerful tool. Pointers can be treated as a form of reference type, a value that refers to another typed value in memory. When most people think of a pointer, they usually treat them a...| Articles on gingerBill
I read the article Let’s stop copying C about 3 years ago. Recently someone brought it up again and I thought I would comment on the points being made. The article argues that newer languages ought not to copy the mistakes of C and comment on may of C’s mistakes. I recommend reading the original article first before reading this one as I will be commenting directly on the subsections of the article. A lot of my comments will be with regards to systems-level programming languages and not p...| Articles on gingerBill
It is lovely to see many new programming languages being produced to solve different issues that the designers are trying to address. Many of the new big ones include Rust, Go, and Swift, all of which are trying to solve different problems. There are some not-as-big programming languages that I recommend everyone to checkout: Odin1 Scopes Zig They are all very good languages but with entirely different philosophies behind them. See if one suits your personal philosophy better! Which brings to...| Articles on gingerBill
A Quine in Odin: package quine import "core:fmt" main :: proc() { fmt.printf("%s%c%s%c;\n", s, 0x60, s, 0x60); } s := `package quine import "core:fmt" main :: proc() { fmt.printf("%s%c%s%c;\n", s, 0x60, s, 0x60); } s := `;| Articles on gingerBill
Pool-Based Allocation In the previous article, we looked at the stack allocator, which was the natural evolution of the linear/arena allocator. In this article, I will cover the fixed-sized pool allocator. A pool allocator is a bit different from the previous allocation strategies that I have covered. A pool splits the supplied backing buffer into chunks of equal size and keeps track of which of the chunks are free. When an allocation is wanted, a free chunk is given. When a chunk is wanted t...| Articles on gingerBill
Stack-Like (LIFO) Allocation In the previous article, we looked at the linear/arena allocator, which is the simplest of all memory allocators. In this article, I will cover the fixed-sized stack-like allocator. Throughout this article, I will refer to this allocator as a stack allocator. Note: A stack-like allocator means that the allocator acts like a data structure following the last-in, first-out (LIFO) principle. This has nothing to do with the stack or the stack frame. The stack allocato...| Articles on gingerBill
Linear Allocation The first memory allocation strategy that I will cover is also one of the simplest ones: linear allocation. As the name suggests, memory is allocated linearly. Throughout this series, I will be using the concept of an allocator as a means to allocate this memory. A linear allocator, is also known by other names such as an Arena or Region-based allocator. In this article, I will refer to this allocator an a Arena. Basic Logic The arena’s logic only requires an offset (or po...| Articles on gingerBill
Memory allocation seems to be something many people struggle with. Many languages try to automatically handle memory for you using different strategies: garbage collection (GC), automatic reference counting (ARC), resource acquisition is initialization (RAII), and ownership semantics. However, trying to abstract away memory allocation comes at a higher cost than most people realize. Most people are taught to think of memory in terms of the stack and the heap, where the stack is automatically ...| Articles on gingerBill
Article was originally posted here: https://odin.handmade.network/blogs/p/3372-exceptions_-_and_why_odin_will_never_have_them Original Comments: https://github.com/odin-lang/Odin/issues/256#issuecomment-418073701 https://github.com/odin-lang/Odin/issues/256#issuecomment-418289626 There will never be software exceptions in the traditional sense. I hate the entire philosophy behind the concept. Go does have exceptions with the defer, panic, recover approach. They are weird on purpose. Odin coul...| Articles on gingerBill
Article was originally posted here: https://odin.handmade.network/blogs/p/2994-on_the_aesthetics_of_the_syntax_of_declarations n.b. This is a philosophical article and not a technical article. There are no correct answers to the questions that I will pose – only compromises. I’m considering what the “best” declaration syntax would be. Historically, there have been two categories: which I will call qualifier-focused and type-focused. An example of qualifier-focused would be the Pascal ...| Articles on gingerBill
Article was originally posted here: https://odin.handmade.network/blogs/p/1723-the_metaprogramming_dilemma Designing this language has been difficult but fun. Two of the original goals of this language were simplicity and metaprogramming however, these together could be an oxymoron. But before I explain why, I first need to explain what I mean by “metaprogramming”. Metaprogramming is an “art” of writing programs to treats other programs as their data. This means that a program could g...| www.gingerbill.org
Contact Info Email:bill [at] gingerbill [dot] org Twitter:@TheGingerBill GitHub:github.com/gingerBill YouTube:youtube.com/GingerGames Public Projects Odin: Programming Language 2016–now An open source systems programming language designed for the modern computer and programmer Odin is fast, concise, readable, and pragmatic. It is designed with the intent of replacing C with the following goals: simplicity high performance built for modern systems joy of programming Website:odin-lang.org Art...| www.gingerbill.org
Package Managers are Evil| www.gingerbill.org
n.b. This is a written version of a dialogue from a YouTube video: 2 Language Creators vs 2 Idiots | The Standup Package managers (for programming languages) are evil1. To start, I need to make a few distinctions between concepts a lot of programmers mix up: A package Package Repositories Build Systems Package Managers These are all separate and can have no relation to one another. I have nothing wrong with packages, in fact Odin has packages built into the language. I have nothing wrong with...| www.gingerbill.org
I sometimes get asked if Odin has any plans to add hygienic macros or some other similar construct. My general, and now (in)famous, answer is to many such questions is: No. I am not against macros nor metaprogramming in general, and in fact I do make metaprograms quite often (i.e. programs that make/analyse a program). However my approach with the design of Odin has been extremely pragmatic. I commonly ask people who ask for such things what are they specifically trying to solve? Usually they...| www.gingerbill.org
I was originally going to write a normal prose article regarding the topic of Pragmatism in Programming, however I thought I’d experiment in style by writing in a proverbial style. The following concepts express the school of thought that I subscribe to which I call Pragmatism in Programming. Proverbs written by Ginger Bill The concept of programming Programming is a tool to solve problems that you have in the domain of computers| www.gingerbill.org
One thing I have noticed a lot when a programmer is struggling to solve a problem, especially a novice, is that he is stuck worrying about the “best way” to implement the solution rather than actually understanding the problem he has. I believe a lot of this stems from not understanding the essence of what programming fundamentally is. Essentially Ordered Aspects In a previous article of mine, I state that “Programming is a tool to solve problems that you have in the domain of computers...| www.gingerbill.org
Originally from replies to a Twitter thread: https://x.com/TheGingerBill/status/1914389352416993395 This is not a structured argument against FOSS/OSS but my uncommon thoughts on the topic. I am not sure if I agree [that FOSS/OSS derives from the same thinking process as the ideology of communism], but I understand the sentiment. The fundamental issue is that software is trivially copyable. I have loads of issues with FOSS and OSS1. And part of this “ideology” (as presented in the origina...| www.gingerbill.org
[Originally from a Twitter Thread] Original Twitter Post I don’t know if I have “ranted” about this here before but: I absolutely HATE comparing programming languages with “benchmarks”. Language benchmarks rarely ever actually test for anything useful when comparing one language against another. This goes for ANY language. Even in the best case scenario: you are comparing different compilers for the same language (and the same input). This means that you are just comparing how well ...| www.gingerbill.org
One of my favourite things about Go is the defer statement. The defer statement pushes a function call onto a list; the list of saved calls in called when the function returns. Imitating this is C++ is impossible. Instead of calling when the function calls, you can call at the end of scope; this is a better approach for C++. This is similar to how D has scope(exit). C++11 Implementation template struct privDefer { F f; privDefer(F f) : f(f) {} ~privDefer() { f(); } }; template privDefer def...| www.gingerbill.org
NOTE: This is based on, but completely rewritten, from a Twitter post: https://x.com/TheGingerBill/status/1802645945642799423 TL;DR It makes Go feel too “functional” rather than being an unabashed imperative language. I recently saw a post on Twitter showing the upcoming Go iterator design for Go 1.23 (August 2024). From what I can gather, many people seem to dislike the design. I wanted to give my thoughts on it as a language designer. The merged PR for the proposal can be found here: ht...| www.gingerbill.org