# \`Indexer\` and \`Int\` vs \`UInt\`

**URL:** https://forum.modular.com/t/indexer-and-int-vs-uint/2210
**Category:** Standard Library
**Created:** [September 2, 2025, 3:48am UTC](https://forum.modular.com/t/indexer-and-int-vs-uint/2210 "2025-09-02T03:48:21Z")
**Posts on this page:** 1
**Showing post:** 81

<div class="post-metadata">

### Author: ![Nick](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/nick/32/115_2.png) [@Nick](https://forum.modular.com/u/Nick)
#### Post date: [September 8, 2025, 5:28am UTC](https://forum.modular.com/t/indexer-and-int-vs-uint/2210/81 "2025-09-08T05:28:52Z")

</div>

> [@clattner](#):
>
> Please don’t worry about this, at least in this way. In the [Mojo roadmap](https://docs.modular.com/mojo/roadmap/) we have have been very clear that we’re building into the python community, but our goal is not to “be python”.

This is a bit of a straw man argument 😕 .

I’m not a huge fan of Python, and I certainly don’t want Mojo to “be Python”. What I want is for programmers coming to Mojo to be able to build cool apps that are fast, secure, and reliable.

My concern is that `Int` is an incredibly subtle data type in Mojo, and yet the name doesn’t reflect this. When programmers come to Mojo (from anywhere!), they are going to bring their misconceptions about what an `Int` should be used for. The name implies that it’s the “simplest” integer type, whereas in practice, it’s the most complicated. If we pretend this complexity doesn’t exist, we are going to cause our users pain, and that’s what I don’t want to see happen.

As a simple example, let’s say I’m writing a library containing utilities for managing a website. My library defines a struct that stores a tally of `site_visits`. Great, site visits are an integer, so I should use `Int` right?

No… that’s a bad idea! If one of the users of my library wants to serve website requests on a 32-bit ARM chip, when they load the current `site_visits` tally from the database and store it in the `Int`, it’s at high risk of overflowing the integer, if the website becomes popular. (YouTube gets almost 4 billion site visits _every single day_.)

How did we mess this up? The root issue is that the size of `Int` is proportionate to **the amount of addressable memory** on the device upon which the library is running. If you are using `Int` to store a value that has no relationship to the device’s addressable memory (such as `site_visits`), you are misusing it.

I’m sure that a certain subset of Mojo users (e.g. C++ veterans) will spot this mistake, and a few of them will even say “duh, this is obvious”. But as language designers, we are setting ourselves up for failure if we are expecting our users to already be experts on such topics!

We can avoid this quagmire by signposting what an `Int` is _actually_ for. This is very easy to achieve. We just need to choose a better name; one that reminds Mojo users that “this data type is for quantities related to the size of addressable memory”. **The cost of making this change is _very_ small** , and the upsides are potentially significant. Even just putting a single-letter suffix at the end of `Int` would suffice. Consider two alternative universes:

1. Mojo has `Int`, `Int32`, `Int64`, `BigInt`, etc. In this universe, people pick `Int` when they are trying to “move fast” because it’s the simplest-looking choice, and it seems to do the job.
2. Mojo has `IntMem`, `Int32`, `Int64`, `BigInt` etc. In this universe, there is no “default” integer option. Therefore, the user has to **consciously decide** which integer type is the correct choice for their use case. If in doubt, they will always pick `BigInt`, because it is guaranteed to behave correctly, no matter how large its value gets.

As I mentioned earlier, I want Mojo users to build fast and reliable software. I don’t want them to be shipping a bug-riddled app because some library that they are using has chosen the wrong integer type. I acknowledge that there are infinitely many ways to ship a buggy app, but this is one class of bugs that we can mostly eradicate from the language just by naming the integer types carefully. It’s such an easy fix, and there are so few downsides.

**TL;DR:** What I care about is helping Mojo users succeed. The more papercuts we can eliminate with minimal effort, the better. The name of `Int` is such a low-hanging fruit, where the benefits far outweigh the drawbacks, that I think it would be a mistake to not do something about this.

---

_[View the full topic](https://forum.modular.com/t/indexer-and-int-vs-uint/2210)._
