sdthompson1 / babylon

An experimental new programming language with verification features.
https://www.solarflare.org.uk/babylon
Other
1 stars 0 forks source link

Infer generic parameters #2

Closed sdthompson1 closed 3 weeks ago

sdthompson1 commented 1 month ago

It should not be necessary to explicitly provide generic type parameters. E.g.

var m = Just<i32>(100);    // Should be able to say Just(100) instead.
var x = from_just<i32>(m);   // Should be able to say from_just(m) instead.

The compiler ought to be able to infer the type parameters in all cases, because the type of the actual arguments is always known.

Note that users should still be able to explicitly give the type arguments if they want to. The inference is just a convenient short-cut.