The Principal in Principal.toText() is a module in the base library, where the function toText is declared, double check you’ve got a line importing it:
import Principal “mo:base/Principal”;
———
You can actually explore these modules on your local machine, in a terminal: cd $(dfx cache show)/base
Thanks for the explanation, I can live with that. Coming from java I was under the (false) impression that I can use anything without additional imports if they appear in the file.
Coming from Java something you might also want to keep in mind as you start using the base library modules, eg Array, is that by example you’d need to write statements like:
import Array “mo:base/Array”;
var a: [Nat] = [];
a := Array.append(a, [10]);