"Hot" take: Most people who default to regex for a lot of things do not know how to do basic tokenization, let alone general parsing.
A basic tokenizer would a much better option that defaulting to regex everywhere, faster, and much better error handling.
People do ask me why Odin's struct fields are ordered lik C rather than reordered to minimize padding (which is what a lot of new languages like Rust do).
This comment from Russ Cox in 2015 is a good answer as to why Go doesn't do any reordering either:
Why the heck are C++ iterators so bad?! Did no one ever implement a hash map before and thought "I'd like to iterate over this"? Why the heck did the `begin`/`end` nonsense have to become the standard?!
I've been saying this for a few years now but can people please stop using things like ChatGPT as a search engine?!
It's literally trained to be a Bullshitting Engine.
It is trained to given an answer that "looks correct". It has no idea if it actually is.
Esoteric? No.
Impractical? No.
The managerial class has ruined computer science.
But Pascal in 1970 got them right, which is what I did in Odin: bit_set[Enum_Flag; u32]
I am considering writing an article on how Handle-based systems work and how to implement one.
A brilliant article on this is
@FlohOfWoe
's "Handles are the better pointers"
However, sometimes showing a concrete code example helps with understanding it.
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🧵
I need to write an article on the main issue I have with this but it'll probably become half a book:
Package managers for programming languages are inherently bad.
Essentially: some things should not be easier to do, and embracing the complexity of dependency hell is evil.
JavaScript programmers need to be stopped.
Only webdevs could think importing a file over internet was a good idea. No wonder the web is an absolute mess.
SERIOUSLY? "got wrong" is even thinking it was a good idea in the first place.
Mini-Rant:
Rust was not built to be a fast language, it was built to be a memory safe language.
Rust is compiled & that usually implies it will be faster than non-compiled languages. But that doesn't mean it is fast compared to other languages designed for performance.
Sadly the state of affairs.
For languages that are trying to be evolutionary (like Odin and C3) rather than revolutionary (pretty much everything else, i.e. things with a "killer feature"), even attempts to market them is harder as they are not hypeable by their very nature.
@neogoose_btw
It's very unlikely since in the current playing field the adaption of a language depends on the amount of propaganda you are able to pump into social media.
It's best to just stay above all of this bullshit and just enjoy Recreational Programming in a decent language.
Can people please stop designing NEW file-formats/protocols that use big endian anything?
You don't have to use big-endian just because that's "network-endian". The network doesn't care: it's all just bytes. Pretty much all machines use little-endian, so design around that.
I have no idea if this tutorial is good or not, but I do agree that everyone should learn how to write a HTTP server.
HTTP 1.1 is a very simple protocol that everyone should understand, even if you are not in the webdev world.
the "build Your own HTTP server" challenge on
@codecraftersio
is free this month
trying something fun. who wants to build this project as well and hold each other accountable to finishing it?
challenge can be done in Go, TS, C, etc. details below!
@FreyaHolmer
Honestly, this is actually THE BEST way of doing it.
Showing that you just copy it to the Applications folder also implies that uninstalling it means you delete it from that folder.
This is one of the things OSX/macOS got correct.
JavaScript programmers need to be stopped.
Only webdevs could think importing a file over internet was a good idea. No wonder the web is an absolute mess.
SERIOUSLY? "got wrong" is even thinking it was a good idea in the first place.
@cmuratori
Wait...
So it's not just Wirth's Law[1] in effect but also the hardware is not becoming faster as quickly because the software developers cannot utilize it well yet?!
That's a vicious feedback loop!
[1} software is getting slower more rapidly than hardware is becoming faster
I've been thinking about why C won out over Pascal over the years. These are my general thoughts 🧵:
(1) There were way too many variants of Pascals out there, compared there being very few C variants
(2) Pascals were more verbose to type (even if you read more than write)
odin build .
For the vast vast majority of things, you don't need a build system. Odin's foreign import system defines all of the linking aspects directly in the source code and only links with stuff that you actually use too.
for all of those that want to learn C
try zig
reasons
1. its build system is much better
2. it has testing built in
3. it will teach you everything that c will teach you other than a couple of base concepts that are not hard to learn without all the suck
it really is awesome
🧵 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".
Metal in Native Odin!!! No need for Objective-C or Swift any more it seems.
(I had to do the obligatory RGB triangle)
This means that Odin will ship out of the box with Metal, Vulkan, and OpenGL, and libraries such as GLFW and SDL!
Only D3D to go!
I do dislike people (incorrectly) quoting Knuth about "premature optimization". I think a much better variation on the phrase for a different thing is much more applicable in virtually all cases:
Premature generalization is the root of all evil.
Procedures operating on structs is Object "Oriented" Programming?
Now that's a take which literally makes the term OOP meaningless.
Where is the encapsulation? Data abstraction? Polymorphism? Composition? Inheritance? SOLID?
Guys like this will complain forever about oo programming and then write a shitload of C functions that all start with a struct pointer thay they operate on
@Hasen_Judi
They want a functional language rather an imperative procedural one.
But if that call is only used once, that inline switch is clearer to read too. Why make the user jump around the code?
🧵I want to clarify my position on "Undefined Behaviour" (UB) in programming languages and why
@odinlang
will not have any UB. It's a pretty simple position: the specification for the language will states who defines what, and then that thing defines it. 1/7
Windows 11 is so great that having installed Python, adding it to the path, and then trying to run it from cmd.exe, it tells me to download it from the Microsoft Store instead...
In my fork of the RadDebugger, I've added support for two View Rules: `slice` to view slice-like data structs (I cover most cases that people would have), and `odin_map`.
`odin_map` is for viewing a `map` from Odin.
I'm not even sure why the Rust Foundation made this decision. It's absolute pure insanity.
For Odin, do whatever you want with it. The compiler has the BSD 3-clause licence for this reason! It's also why I made Odin; I wanted the freedom of choice of language to do what I want!
This is the BEST PR I have ever seen (at least for Odin). The amount of time that has gone into this, let alone the code itself, is impressive and honourable.
It's got GIFs, tables, detailed explanation to the rationale, modifications, and so much more.
I've changed my mind on automatic code formatters over the years.
I used to like them because I "believed" they reduced my mental overload of doing the formatting.
Then changed my view to "enforce _a style_ regardless of whether I like it or not".
Now I find them insulting.
To quote what I said earlier:
Premature generalisation is the root of all evil.
This is what I mean. This is someone who made an extremely generic thing, and I bet it wasn't even needed ever.
Anyone who does this should be fired out of a generic proverbial cannon.
if you committed this to a codebase i worked in, i would do everything in my power to replace this with a couple asserts and see to it you leave my team
please for the future you do not commit code you don't understand
The end frame of this evening's stream.
It was a very fun stream! I made a card game that had a good mix of randomness and skill to it.
Stay tuned for the recording to be uploaded to YouTube!
As I cannot see the rest of the code, and I will assume it is all like this, what is wrong with it? Seriously.
It's doing a name check, and then doing a bit of specific non-generalizable logic per check, and then doing non-generalizable logic for the final value.
We have a brand new project in the Odin Showcase: CAT & ONION
A cozy and whimsical short cat adventure game! It is fully written in Odin with
@raylibtech
, created by
@karl_zylinski
.
@tsoding
Linked lists can be fine if you allocate them correctly in contiguous localized memory. The problem is usually due to people using `malloc` and that allocates it all over the place.
I tweaked the card game from last night to use the full deck + an extra set of court/face cards.
This is unironically a fun "solitaire" game for saying it was designed and made in ~2 hours and then partially polished in ~2 hours.
GO MAKE GAME PROTOTYPES!
I know programming is "just a job" for many people. I originally pursed physics, specifically metrology (quantum and micro).
Physics has a massive place in my heart, and I still do it in the computational sense, but I do love the joy that programming gives me—my career now.
@supahvee1234
@cmuratori
Do you think you are being honest or are you actively lying?
Your code has separate arrays of specific types not than a single array of multiple types. You've literally done an AOS to SOA transformation as an optimization. You've just proven Casey's point about performance.
What really annoys me about the design of the these iterators is that they are overly complicated for very few good reasons. I understand why it is are designed the way it is, but this is not how I'd want to design it at all. This is what I'd do as a language designer.
I'm sorry, but Go is going in the wrong direction with range over functions, iterators, etc.
The core promise of the language was simplicity. Why the Go team is so eager to flush it down the drain is beyond me.
I never signed up for this crap.
I was brought attention to this article, and specifically this table, on this site:
Except for the "Examples" row, NONE of the rows are correct.
My favourite being that "Procedural programming is based on the _unreal world_". 🤣
Minimizing padding does seem like a good idea in that it does make structs smaller. However, and this might be an experience bias, I just naturally pack structs and arrange fields in the order that they get accessed together with most of the time.
I thought I'd briefly actually explain where Odin's style of tagged unions come from:
ALGOL68.
Yes, you read that correctly.
When people think of "proper unions", they want ML-style, but there are a few different traditions out there. ALGOL68, Pascal, ML, and hybrids.
I don't know how many times I have to repeat this but:
DO NOT USE LANGUAGE BENCHMARKS AS A WAY TO COMPARE LANGUAGES!
They are all bogus. This website particularly:
And my previous rant:
This is an After Effects plugin created by "graphisco" from the Odin Discord server, and it is 100% written in Odin (except for third party licensing libraries).
I wanted to plug this as it is now available to purchase and looks absolutely amazing!
Does anyone know why there are not many languages that support fixed-point arithmetic as a native data type?
I know floating-point has kind of won, but there are many benefits to fixed-point. Did floating-point win because languages natively supported with syntax?
Friends of mine have just launch a new multiplayer game on multiple platforms (iOS, Windows, and Mac), using a fully custom game engine.
It's a nice selection of games to play, and even more to come soon!
I highly recommend people to check "All Out":
I got Metal working natively in
@odinlang
the other day. I've now gone and got D3D11 and D3D12 working in Odin!
Odin shipping out-of-the-box will all of major graphics APIs: Metal, D3D11, D3D12, Vulkan, OpenGL, and WebGL!
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.
The annotated profiler for the Odin compiler on a large project. 90% of the time is out of our control (LLVM and Linker).
The frontend is taking about 500ms for a ~150 KLOC Odin project (equivalent to 0.5MLOC of C effectively), so not bad in terms of type checking.
Hell is LLVM
🧵 Why Odin was not designed as an OOP language:
I have been asked numerous times before about the reasoning for not having methods (member procedures) in
@odinlang
, and why it only has stand-alone procedures. 1/9
Can someone explain to my why people believe that C-style for loops should not be in a "modern programming language"?
If the argument is "ranges or iterators replace the need", in the latter case: please show me the generated machine code (especially without optimizations).
If "middleware" in the web world is called that because it is in the "middle" of the pipeline, does that mean there is such thing as "beginware" and "endware"? If not, I am now coining those terms.
The Actor Model and CSP are mathematical duals of each other, or just exact opposites of one another by default.
I'll start explaining both concurrency models in terms of a graph of threads and communication.
I am unironically still playing that card game I made on Twitch:
I've added 3 different difficulties, the ability to reset a game, and some basic animations.
I did a experimental test today with a colleague about storing the `context` pointer in a thread local variable instead of passing it implicitly to all procedures to see if would be better for performance.
TL;DR it was identical in performance (within experimental bounds)
I'm current experimenting with making -verbose-errors the default in Odin and added ANSI colors if the terminal supports it. Here is what it looks like cmd.exe on my machine:
I pretty much hate do-while loops in C, but implementing Radial/Half Edge data structures is pretty much the only case where a do-while is the bee's knees. I've been having to emulate it in Odin with:
for { ...; (cond) or_break }
I am still never adding do-while to Odin.
@DanielcHooper
Luckily most of the APIs I care about are still implemented in Objective-C. And because of that, I added direct support of Objective-C in Odin so I never need to use Swift.
It's actually nicer to use Metal in Odin than both Objective-C and Swift.
This is not "deeply insane" nor an "optimization" (on itself). The problem exists in C++ too with `const &` stuff. This is just passing parameters implicitly by pointer, which so many languages do.
This approach exists for a reason in many languages.
Why are they two naming traditions for this:
Marshalling/Unmarshalling
Serializing/Deserializing
I know some people make a distinction between the two, and say that serialization is a part of marshalling, but I've always treated them as if they were the same.
Interested in Metal and
@odinlang
? We've just released 10 self-contained code examples ranging from creating a window, to instanced rendering, and even compute shaders all in native Odin!