I’m exploring the Stable variables and upgrade methods :: Internet Computer example. When I use a record as value I got into this strange error that I don’t understand. What is unbound type caller
error about?
import Principal "mo:base/Principal";
import Nat "mo:base/Nat";
import Nat32 "mo:base/Nat32";
import Hash "mo:base/Hash";
import HashMap "mo:base/HashMap";
import Text "mo:base/Text";
import Debug "mo:base/Debug";
type Record = { owner: Principal };
actor Registry {
let records = HashMap.HashMap<Text, Record>(1024, Text.equal, Text.hash);
public shared(msg) func set(name : Text) : async Text {
let caller = msg.caller;
records.put(name, { owner: caller; }); // <-- ERROR: type error [M0029], unbound type caller
return ""
};
public func get(name: Text) : async ?Record {
records.get(name)
}
};