Skip to content

How serious you are about not supporting atoms? #2097

Discussion options

You must be logged in to vote

Atoms are supported, custom types are atoms!

% in Erlang
-type mode() :: on | off.
pub type Mode {
  On
  Off
}

There's no plan for a literal syntax for untyped atoms, but they can be used with the atom module in the gleam_erlang package.

Considering the fact that strings cannot be pattern-matched effectively (as I understand, a string is matched as a list of characters),

Gleam uses binary strings and can be matched on performantly.

And there is also map structure in gleam. Isn't it a smarter thing to use atoms as keys?

The key type of the Map type is parametrised and can be any type, including atoms.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pwtail
Comment options

Answer selected by pwtail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants