Pudu programming language
Menu
API reference

Std.LinkedMap.LinkedMap

1 declaration

type

LinkedMap

This declaration introduces a public type.

What it does

A map that also remembers the order its keys were first put in.

Map deliberately does not. Two maps with the same entries are the same

map there, however they were built, and that is what makes them compare and

print alike — a promise worth more than insertion order for the map every

program reaches for first.

It is worth less than insertion order for the programs that have to give

something back to a person. Configuration written to a file, a request log,

the columns of a report, the fields of a form: each is read in an order

somebody chose, and handing it back sorted silently discards that choice.

Today those programs keep an array of keys alongside a map and are careful

to update both, which is a bug waiting for the one place they forget.

The order is of first insertion. Writing to a key that is already here

changes its value and leaves it where it is. That is what separates this

from a recency order, and it is the one a person means: a setting does not

move to the bottom of the file because it was edited.

Read the signature

  • This declaration has no value signature because it introduces a type or trait.

Back to Std.LinkedMapSearch related declarations