How to use OrderedMap from base in a module?

I wrote in a module:

import Map "mo:base/OrderedMap";
...
module {
  ...
  let stringMap = Map.Make<Text>();
  ...
}

and got the error: non-static expression in library, module or migration expression Motoko(M0014).

What should I do in this situation? Which of the following is better?

  func stringMap(): Map.Operations<Text> {
    Map.Make<Text>();
  }
  1. Write Map.Make<Text>() in every function that uses it.

Other variants?

See also my older question: Peculiarities of using `OrderedMap` in a structure

You need the operation class to create and use the map.

You can create the operations class by using make :

import Map "mo:base/OrderedMap";
let stringOp = Map.Make<Text>(Text.compare);

You can then create the actual key store using map

let stringMap : Map.Map<Text> = stringOp.empty();

You also cannot use this structure in a module because it is stable- only actors can persist data. Use a hashmap. This data structure is quite peculiar because it separates operations from the key store map, it can get confusing.