What does "Iter/3" refer in "ls.vals; func : () -> Iter/3<Text>"

Hi
I am compiling my code in motoko compiler.
I came across the below output.

> ls.vals;
func : () -> Iter/3<Text>

Can someone explain what it means to Iter/3 in the above output please.

The /N suffix is just a way in which the compiler’s output distinguishes multiple types of the same name that might be in scope, some potentially shadowed by others.

Consider:

> type Q = Nat;
type Q = Nat
> func f(x : Q) {};
let f : Q -> () = func
> type Q = Text;
type Q/1 = Text
> func g(x : Q) {};
let g : Q/1 -> () = func
> type Q = Bool;
type Q/2 = Bool
> func h(x : Q) {};
let h : Q/2 -> () = func
> (f, g, h);
(func, func, func) : (Q -> (), Q/1 -> (), Q/2 -> ())

The type Iter is probably declared in multiple places in the base library, that’s why you see the notation popping up. (The compiler should probably be smarter about displaying this information only when needed.)

3 Likes

Thank you so much @rossberg :slightly_smiling_face: