motoko icon indicating copy to clipboard operation
motoko copied to clipboard

Feature Request: Better Type Inference

Open Gekctek opened this issue 1 year ago • 2 comments

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

Gekctek avatar Jan 08 '24 21:01 Gekctek

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.

iclighthouse avatar Mar 18 '23 09:03 iclighthouse