On Wednesday, 6 January 2021 at 11:11:41 UTC, Ola Fosheim Grøstad
wrote:
On Wednesday, 6 January 2021 at 10:55:39 UTC, Ola Fosheim
Grøstad wrote:
int[_] = …
or
_[_] …
To expand on this with more examples, you might want to
constrain "auto" in various ways with pattern matching:
// ensure static array of something with length 4
_[4] v = f();
// ensure that I get a MyContainer with some unspecified type
elements
MyContainer<_> c = g();
// define a function that swaps the content of an array of
length 2
void swap(ref _[2] a){ … }
// it would also be shorter than auto, but not sure if that is
a good thing
_ x = 3 // same as "auto x = 3"
I thought about auto when reading the DIP too, but auto is more
used like a Type (although being a storage class ;) ). It's never
used to infer a value, i.e an expression. While I understand what
you mean this is unrelated. Dollar is very well suited.
Maybe you could create the underscore-lang to showcase the idea ;)