Comment

Comment by qcnguy

Haskell has this, it's called newtype.

In OOP languages as long as the type you want to specialize isn't final you can just create a subclass. It's cheap (no additional wrappers or boxes), easy, and you can specialize behavior if you want to.

Unfortunately for various good reasons Java makes String final, and String is one of the most useful types to specialize on.

parent qcnguy 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton