Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm most interested in Scala's structural typing.

Are there any studies comparing real world impact of structural vs nominal typing?

Defects? Code size? Team size? Architectural choices, big and small, like use of Visitor design patterns?

I've looked, but no joy.

--

FWIW, metaprogramming should be reserved for personal projects and small high trust teams. Definitely not for bog standard data processing and CRUD apps.

I'm kinda curious how structural typing story plays out in this dichotomy.



Scala _can_ do structural typing, but you almost never see it in the wild so I don't think you'll be able to find any data on it. The main reason why it isn't used in Scala is because it's implemented using run-time reflection which can be slow.

From the time I've spent working with Typescript (Probably the most mainstream with with structural types), I don't think structural-by-default is the right approach if we are to design a language for safety & productivity. The error messages are a lot worse than nominal typing, and useful patterns like new type are either not safe or has a runtime cost. [1]

I suspect nominal first with good structural typing support from the compiler is where the sweet spot is, but to integrate it nicely in any language used today is probably an open research question.

[1] https://kubyshkin.name/posts/newtype-in-typescript/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: