motoko
motoko copied to clipboard
Feature Request: Better Type Inference
The following does not seem to work in Motoko without either declaring types in the method generics or on the function definition for Iter.map()
let arr : [Int] = [1, 2, 3];
let arr2 : [Int] = arr |> Iter.fromArray(_) |> Iter.map(_, func x = x + 1) |> Iter.toArray(_);
Can be frustrating having to put type definitions everywhere with method calls like this, even if it seems clear what the types would be, especially when the type names get very long or are complex tuples
It is true that such conventions should not be written in the standard, and even if they are, they are meaningless. This is because the goal of the standard is to achieve interoperability, and the internal details in implementing the examples (without affecting interoperability) should not be in the standard.