Odin

49 readers
1 users here now

A community for the odin programming language! https://odin-lang.org/

founded 9 months ago
MODERATORS
1
3
August 2024 Newsletter (odin-lang.org)
submitted 3 months ago by mac to c/odin
2
 
 

Why did you decide to work with Odin?

What did you build with Odin?

Where does Odin shine? What could use some polish?

3
 
 

Karl Zylinski writes:

This article is an introduction to the Odin Programming Language. It is aimed at people who know a bit of programming, but have never touched Odin. It is not a reference guide, rather I try to keep things informal and talk about what I think are important aspects of the language. There will be some notes on differences to C/C++, as Odin in many ways tries to be better C. If you enjoy this article and want to support me, then you can do so by becoming a patron.

In the recent years most of my programming has been done using the Odin Programming Language, sometimes referred to as Odinlang. Since a year back I create my own video games using Odin. You can find my game CAT & ONION on Steam, it is completely created in Odin.

...

While Odin is a great language, it is currently quite lacking in documentation. There is lots of documentation, but it is scattered and incomplete. I tried to address that by writing this article, which I hope gives a holistic introduction to the language.

Read Introduction to the Odin Programming Language

4
8
July 2024 Newsletter (odin-lang.org)
submitted 4 months ago by mac to c/odin
5
7
submitted 6 months ago* (last edited 6 months ago) by ericjmorey to c/odin
 
 

I'm sharing this Discord Message from someone that was doing their best to fill in their gaps in understanding Odin after reading the Overview documentation on odin-lang.org.

This was somewhat confusing, I could change the package foo at the top of the file and it makes no difference and everything works.

From reading this Server, I learned a lot, like this:

  • 1 - The package is only linked to the directory name (folder) and nothing else, except;
  • 2 - The files in the package directory must all have the same package foo header with the same name, but it does not have to be the same as the package directory name, just unique (see below); and
  • 3 - No two packages can have the same directory/folder name (globaly unique); and
  • 4 - No two packages can have the same package foo header names (i.e., must be globally unique but not tied to any package (directory) name needed - but would be a good idea, I mean why not...);
  • 5 - You cannot have cyclical imports - ever;
  • 6 - The package foo header seems powerless for the most part as far as programmer use, but I read it is used by the ABI as a prefix for symbols in the final binary;
  • 7 - Sub-packages do not exist, so even nested directories are standalone packages and also do not infer dependence;
  • 8 - In Odin you should put as much in one package as possible and do not use packages for namespaces since it will not work (see using) and do not use packages to organize your files, see 9 for proper reason to use packages;
  • 9 - Use separate packages only as reusable (stand alone) libraries;
  • 10 - Organize files within a package directory by their filenames (ala Java) and not subdirectors for all the reasons above; which is what I will do using snake case for the file names.

If I blew it above let me know.

imho the Overview would do better to include a little more detail like some of the stuff above. When I searched this server I found a huge amount of the above and just cobbled it together from 6-7 posts. I think what was not clear from the overview was: 1, 5, 6, 7 (its there but not clear), 9. It is clear that many people are confused by this, but on the bright side searching the Discord was very useful.

gingerBill indicated this is a common source of confusion for newcomers to Odin:

package name has nothing to do with the thing you import.

This is probably one of the most confusing things about Odin's packages. The exist for stable ABI and consistent linking names.

Hopefully, I can create a minimum working example that can be illustrative for others and have a PR merged into the Overview documentation. Until then I just want something that can be found outside of Discord for other learners.

6
2
submitted 9 months ago by mac to c/odin
7
3
submitted 9 months ago by mac to c/odin