Skip to content

Conversation

eksperimental
Copy link
Contributor

No description provided.

#### Problem

An `Atom` is an Elixir basic type whose value is its own name. Atoms are often useful to identify resources or express the state, or result, of an operation. Creating atoms dynamically is not an anti-pattern by itself. However, atoms are not garbage collected by the Erlang Virtual Machine, so values of this type live in memory during a software's entire execution lifetime. The Erlang VM limits the number of atoms that can exist in an application by default to *1_048_576*, which is more than enough to cover all atoms defined in a program, but attempts to serve as an early limit for applications which are "leaking atoms" through dynamic creation.
An `Atom` is an Elixir basic type whose value is its own name. Atoms are often useful to identify resources or express the state, or result, of an operation. Creating atoms dynamically is not an anti-pattern by itself. However, atoms are not garbage collected by the Erlang Virtual Machine, so values of this type live in memory during a software's entire execution lifetime. The Erlang VM limits the number of atoms that can exist in an application by default to *1,048,576*, which is more than enough to cover all atoms defined in a program, but attempts to serve as an early limit for applications which are "leaking atoms" through dynamic creation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that commas are locale specific. Not all languages and location use the same. For example, in Brazil, we would use dots. Perhaps we do `1_048_576` and have it show up as actual code, as in the other PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the documentation is written in English language. I would say along with the white-space separator is the most common in English speaking countries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language and localization are two different things. Assuming people speak english is one thing but assuming they are all in a certain locale is another. But without going into this whole discussion, let's ask this instead:

  1. Do we use this convention anywhere else in the codebase?
  2. Why not use 1_048_576 is would be unambiguous for Elixir developers regaradless of their locale?

Copy link
Contributor Author

@eksperimental eksperimental Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it only here:

lib/elixir/lib/calendar/time.ex
784:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian
840:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian

lib/elixir/lib/calendar/date.ex
636:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian
670:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian

lib/elixir/lib/calendar/datetime.ex
1925:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian
1972:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian

lib/elixir/lib/calendar/naive_datetime.ex
1264:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian
1330:  Gregorian calendar that adds exactly 10,000 years to the current Gregorian

Using 1_048_576 works in this case because it is not an introductory material, but given the case of someone new to Elixir reading this, I don't think _ would mean much.

I'm OK with using 1_048_576, but I think it is something to think about.

@kipcole9
Copy link
Contributor

kipcole9 commented Jul 9, 2025

Perhaps we could follow the Bureau International des Poids et Mesures (BIPM) recommendations and use either a non-breaking space or a thin space ?

From Wikipedia

The use of thin spaces as separators[31]: 133  instead of dots or commas (for example: 20 000 and 1 000 000 for "twenty thousand" and "one million"), has been official policy of the International Bureau of Weights and Measures (BIPM) since 1948 (and reaffirmed in 2003), [27] as well as of the International Union of Pure and Applied Chemistry (IUPAC),[32][33] the American Medical Association's widely followed AMA Manual of Style, and the UK Metrication Board, among others.

@josevalim
Copy link
Member

Using thin space sounds good to me. There is a chance someone will copy it to Elixir but we should show a good error message.

@eksperimental
Copy link
Contributor Author

Should we go ahead and replace the "10,000 years" entries as well?

@josevalim
Copy link
Member

Yes, let’s do it please.

@eksperimental
Copy link
Contributor Author

Done. It looks like this:

image
image

@josevalim josevalim merged commit 8bc49af into elixir-lang:main Jul 10, 2025
14 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

josevalim pushed a commit that referenced this pull request Jul 10, 2025
@eksperimental
Copy link
Contributor Author

Thank you Kip for the suggestion.

@eksperimental eksperimental deleted the chore/use-commas-in-numbers branch July 10, 2025 10:16
@eksperimental eksperimental changed the title Use commas as a separator instead of "_" in regular English language Use thin-space as a separator in regular English language Aug 30, 2025
@eksperimental eksperimental changed the title Use thin-space as a separator in regular English language Use thin-space (U+2009) as a separator in regular English language Aug 30, 2025
@eksperimental eksperimental changed the title Use thin-space (U+2009) as a separator in regular English language Use thin-space (U+2009) as a numeric separator in regular English language Aug 30, 2025
eksperimental added a commit to eksperimental-forks/elixir that referenced this pull request Aug 30, 2025
josevalim pushed a commit that referenced this pull request Aug 30, 2025
ggVGc pushed a commit to ggVGc/elixir-verbatim that referenced this pull request Sep 12, 2025
ggVGc pushed a commit to ggVGc/elixir-verbatim that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants