News for hackers. Stuff that matters.
Re:Don't Be Afraid of Types by jandrewrogers on Saturday March 22, 2025 @03:02AM (#43444089)
Anonymous types are a thing in some languages. You also have adjacent concepts like anonymous namespaces in which you can dump types that require a name so that the names don’t leak out of the local context.

Sufficiently flexible namespaces do solve most of these problems. Java is kind of perverse though.

Re:Don't Be Afraid of Types by gleenn on Saturday March 22, 2025 @03:04AM (#43444100)
Java:

Map m = new HashMap() {{ System.out.println("I am a unique subclass of HashMap with a single instance!");}};