On Mon, Jun 23, 2014 at 11:03 PM, George Leontiev <
fol...@gmail.com> wrote:
> Another thing that bugs me – it seems a bit strange to have a possibility to
> infer some type, but no possibility to manually specify it. Specifying the
> expected type of an expression is pretty much the enabler of the "follow the
> types" approach, which I personally find quite useful.
As I said, I'm not opposed to being able to specify literal singleton
types explicitly. However, we almost always want these types inferred
from values: I believe the exceptions to this are extremely rare.
When it comes down to it, I think ".type" is ugly and unnecessary
syntax. What we're groping towards in the ability to index types by
values. That being the case, why don't we just do exactly that. Let's
drop the ".type" suffix altogether and allow any stable value (I can't
remember whether literals are currently classified as stable, but
there's no reason why they shouldn't be) in a position expecting a
type to be automatically promoted to the corresponding singleton type.
This would make the few scenarios where explicit literal singleton
types are useful a great deal more pleasant (ie. Matrix[Double, 3, 3]
rather than Matrix[Double, 3.type, 3.type]).
Cheers,
Miles