News for hackers. Stuff that matters.
Re:Better C – A subset of D Programming Language by choward on Tuesday April 28, 2020 @10:56AM (#23007596)
Hard disagree. If you are assigning a value that's the result of an expression you might have somewhat complicated logic. Being able to say what you expect returned is very useful.

    MyClass myVar = something ? SomeFunction() || somethingThatMightBeASubClassOfMyClass
Re:Better C – A subset of D Programming Language by Koshkin on Tuesday April 28, 2020 @11:42AM (#23008094)
Anything wrong with

   var myClass = ...
(or some other descriptive name of the variable)?
Re:Better C – A subset of D Programming Language by Pxtl on Tuesday April 28, 2020 @11:58AM (#23008285)
Personally I prefer this, since it also carries on to every following line.

Like, in C#

    List<Account> accountsToDelete = accountService.GetAccountsToDelete();    
    repository.Delete(accountsToDelete);
becomes

    var accountsToDelete = accountService.GetAccountsToDelete();
    deleterService.Delete(accountsToDelete);
So as much type information is already encoded into names so that all references to this object are clear in what we're handling, and so the type declarations at the point where the variable is declared is just redundant noise.

If your variables aren't informative when I'm reading the code, I'll be confused 5 lines later anyways. So make them informative at the start. And given that, doesn't that mean the List<Account> is a bit redundant?

Re:Better C – A subset of D Programming Language by enhray on Tuesday April 28, 2020 @12:31PM (#23008653)
Beware the m_pszSlipperySlope [0].

[0] https://en.wikipedia.org/wiki/Hungarian_notation

Re:Better C – A subset of D Programming Language by edflsafoiewq on Tuesday April 28, 2020 @02:08PM (#23009936)
Even if you have var/auto, you don't have to use it every time.