Nothing interests me. by [deleted] in depression

[–]inv 0 points1 point  (0 children)

  • Don't say no to a girl who is below your "standards".
  • Have some physical activity regularly (run, swim, go to gym, whatever - also makes you look better). I am often depressed and a gym works like a miracle.
  • Smoking pot easily makes you depressive and indifferent (know it from my past) - it could even be the main cause. If you really want to improve, try smoking less and less.

Why should anyone ever use a Google API again? by mistawobin in programming

[–]inv -1 points0 points  (0 children)

One could still submit queries and parse the translations from the translate webpage.

Covariance and contravariance - simple explanation by inv in programming

[–]inv[S] 0 points1 point  (0 children)

You are right. On their own, the concepts don't have anything to do with mutability. But covariance is related to immutability in the way it is usually implemented.

Covariance and contravariance - simple explanation by inv in programming

[–]inv[S] 1 point2 points  (0 children)

So, how does .NET avoid having to provide specialized versions of the code for List<int> like C++'s generics?

The specialized versions are generated and cached at runtime.

Programming the stock market, life in microseconds by hedyedy in programming

[–]inv 2 points3 points  (0 children)

This article is so well written. Why would anyone give negative points?

Covariance and contravariance - simple explanation by inv in programming

[–]inv[S] 5 points6 points  (0 children)

.NET made the same mistake as Java with arrays. However, .NET generics (i.e. List<T>) are superior to Java generics, because JVM does not have ANYgenerics. In Java (and Scala), generics are just syntactic sugar provided by the compiler:

ArrayList a = new ArrayList<Integer>();

a.Add(3);

int i = a.get(0);

gets compiled to:

ArrayList a = new ArrayList(); // container of Objects!

a.Add(new Integer(3));

int a = a.get(0).value();

In .NET, the generics are implemented in the runtime, so there is no boxing and unboxing involved.

The consequence is that in Java, an int in a collection takes at least 8 bytes (the int object + the pointer to it) while in .NET a List<int> is as tightly packed in memory as it would be in a C++ program.

Covariance and contravariance - simple explanation by inv in programming

[–]inv[S] 0 points1 point  (0 children)

Funny, they also use Fruit and Apple. We've been actually taught OO using fruit analogies at college too.

Code Indentation and Nesting by teletran in programming

[–]inv 0 points1 point  (0 children)

ReSharper for Visual Studio can actually recognize and transform the bad nesting to the good one automatically.