News for hackers. Stuff that matters.
Re:Nim in 2018: A short recap by bluejekyll on Wednesday January 09, 2019 @11:05AM (#18865761)
Have you considered that in instances where type inference (I haven’t used Nim, but this is true of Rust, Kotlin, Swift, etc) can be used, having the type follow the variable is vastly superior from a readability point of view?

It didn’t take me long to prefer this syntax to that of Java, C, C++, etc.

Re:Nim in 2018: A short recap by Nimitz14 on Wednesday January 09, 2019 @03:43PM (#18868647)
I do not understand how having it on the right should help where type inference is used, as in that case you do not write the type at all! There's absolutely no difference in readability.

How about we consider the normal case (where you write out the types):

    int num_entries = ..
    float div = ..
    float result = num_entries // div
vs

    num_entries: int = ..
    div: float = ..
    result: float = num_entries // div
Because they are on the right, they aren't aligned which makes it harder to parse (imo). It gets even worse with more complicated types (lists etc).
Re:Nim in 2018: A short recap by bluejekyll on Wednesday January 09, 2019 @04:09PM (#18868911)
You left out a type inference example:

let foo = Bar();

Anyway, these are all subjective perspectives, but I was personally won over to them, especially as I started using type inference more often.

Re:Nim in 2018: A short recap by a1369209993 on Wednesday January 09, 2019 @02:22PM (#18867889)
> having the type follow the variable is vastly superior from a readability point of view?

[citation needed]

The way Nim, Rust, etc do it, with a useless 'var' keyword even when a type is present, is clearly needlessly verbose (ie, inferior, though I'd hesitate to say vastly), but I'd be interested to see a analysis of the merits of something like "Foo[2] foo = bar()" vs "foo Foo[2] = bar()" (or maybe that should be "foo [2]Foo = bar()"?), since it hadn't actually occurred to me to use the latter order seperate from the useless keyword.

Re:Nim in 2018: A short recap by steveklabnik on Wednesday January 09, 2019 @02:33PM (#18867976)
It’s not useless in Rust, it significantly simplies the grammar. This is good for both humans and tooling.
Re:Nim in 2018: A short recap by mratsim on Thursday January 10, 2019 @09:45AM (#18874141)
var isn't useless, it indicates mutability.
Re:Nim in 2018: A short recap by a1369209993 on Thursday January 10, 2019 @01:57PM (#18876780)
Ah, that makes sense, thanks. (Although I think that's specific to Nim?)