Primitive and Reference Types - Squeng/Polyglot GitHub Wiki

Scala has no primitive types, "only" reference types, and that uniformity is a good thing.

Java has both primitive types and reference types, which can be a source of (subtle) bugs caused by unexpected autoboxing and unboxing:

long primitiveL1 = 9876543210L;
long primitiveL2 = 9876543210L;
System.out.println((primitiveL1 == primitiveL2) + "  <- 👌");
Long referenceL1 = Long.valueOf(9876543210L);
Long referenceL2 = Long.valueOf(9876543210L);
System.out.println((referenceL1 == referenceL2) + " <- 🤬");
System.out.println(referenceL1.equals(referenceL2) + "  <- 👌");
System.out.println((primitiveL1 == referenceL1) + "  <- 🤯");

Java Playground

Python has no primitive types, "only" reference types, and that uniformity is a good thing.

Primitive vs. Reference / Stack vs. Heap

Well, strictly speaking, Scala's boolean, character, and numeric types feel like reference types until compile time, but are primitive types during run time, which gives Scala developers the best of both worlds: everything's an object and yet number crunching is very performant.